the problem is all about round trip so all you have to do find they difference between lowest value and highest value and then multiply by two. That's all. Because the resultant value contain the round trip. If you want to calculate the parking position that will be the middle value after sorting all value Good luck :)
This problem is one of the easiest problem. All you have to do is find the result after calculation which is given in the problem.
can be rewrite author:
After calculating this we need to find out the 10th position of the number. To find out that we can use modulus
res = res % 100
This provide the last two digit of the number. Then we can find out our final result by
That's all :)
This is also very simple program. You can solve this problem only with switch-case/ if-else block. Main concern about this problem is getting input form console. You can't do with regular cin.
cin>>variable;
All you need to do is getline through which you can work directly with string i/o.
getline(cin,mystr);
Keep in mind the "Unknown" case. That's all :)
This is very interesting problem. All the information is very funny. The most important information is given as a equation in bolt form. All you need to do is finding the difference between the non-zeros and zeros.
Just use if-ealse block for finding out zeros and non-zeros.
This is easy problem you need to find out string length of the inputted string e.g. two-2, one-2, three-3.
getline (cin,mystr);
int n=0;
n = mystr.length();
You can see that three is standing out of from one and two Because it's length is 5. So, finding out three is very easy.
Now one and two: As input can be miss-spelled by only one character then you can make a if-else block by making combination of three types of wrong spelling that can be possible
if(mystr[0]=='o' && mystr[1]=='n' || mystr[1]=='e')cout<<1<<endl;
else if(mystr[0]=='o' || mystr[1]=='n' && mystr[1]=='e')cout<<1<<endl;
else if(mystr[0]=='o' && mystr[1]=='e' || mystr[1]=='n')cout<<1<<endl;
That's all :)
This is one of the easiest problem. Just check whether any given input is greater than 20 or not. If you found any number grater than 20 then the box is bad otherwise good. That's all :)
This problem is nothing but checking the first word. Then Take action accordingly.
Use this
cin>>mystr;
instead of This
getline (cin,mystr);
Because cin will give you only one word at a time on the other hand getline will give you the entire line as a single string. That' all :)
This problem is just like 2250LanguageDetection