We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- Conditional Statements
- Discussions
Conditional Statements
Conditional Statements
Sort by
recency
|
796 Discussions
|
Please Login in order to post a comment
Create a hash table to solve the problem.
I didn't get this what they had done. If somebody knows please explain.The code by hackerrank is pasted below:
include
using namespace std;
string ltrim(const string &); string rtrim(const string &);
int main() { string n_temp; getline(cin, n_temp);
}
string ltrim(const string &str) { string s(str);
}
string rtrim(const string &str) { string s(str);
}
Here is the most efficient problem solution in c++ programming -- DigitWood https://digitwood.com/conditional-statements-c-hacker-rank-solution-digit-wood/
include
using namespace std; int main(){ int num; cin>>num; if(num==8){ cout<<"eight";
} else if(num==5){ cout<<"five"; } else if(num==1) cout<<"one"; else if (num==2) cout<<"two"; else if (num==3) cout<<"three"; else if (num==4) cout<<"four"; else if(num==6) cout<<"six"; else if(num==7) cout<<"seven"; else if(num==9) cout<<"nine"; else if(num>9){ cout<<"Greater than 9"; } } 1.