- Prepare
- C++
- Introduction
- Conditional Statements
- Discussions
Conditional Statements
Conditional Statements
+ 0 comments using map in c++
map <int, string> m = {{1, "one"}, {2, "two"}, {3, "three"}, {4, "four"}, {5, "five"}, {6, "six"}, {7, "seven"}, {8, "eight"}, {9, "nine"}, }; // creating iterator map < int, string> :: iterator itr; itr = m.find(n); if(itr != m.end()){ cout << itr -> second; } else { cout << "Greater than 9";}
+ 0 comments string arr[9] = {"one", "two", "three", "four","five", "six", "seven", "eight", "nine"}; if(n > 9) cout << "Greater than 9" << endl; else cout << arr[n-1] << endl;
+ 0 comments include
using namespace std;
int main()
{ int a; cin>>a;
{ if(a==1) { cout<<"one"; } else if(a==2) { cout<<"two"; } else if(a==3) { cout<<"three";
} else if(a==4) { cout<<"four"; } else if(a==5) { cout<<"five";
} else if(a==6) { cout<<"six"; } else if(a==7) { cout<<"seven"; } else if(a==8) { cout<<"eight";
} else if(a==9) { cout<<"nine"; }
else { cout<<"Greater than 9"; } return 0; } }
+ 0 comments Panditg is one of the well-known best pandit for kaal sarp puja in ujjain. He is well-versed in the Vedic rituals and can perform the puja in a professional and sacred manner. He is an experienced priest and has been performing Kaal Sarp Puja in Ujjain for many years. He is also well-versed in the mantras and rituals associated with the puja and ensures that they are properly followed.
+ 0 comments void printString(int n){ std::vector<std::string> stringsVector = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; std::string outString = "Greater than 9"; if (n <= 9){ outString = stringsVector[n-1]; } std::cout<<outString<<std::endl; return; }
Sort 707 Discussions, By:
Please Login in order to post a comment