i am sup by the way. so im guessing i win?
Answer:
#include <bits/stdc++.h>
using namespace std;
int main() {
string in;//string in for taking input...
cout<<"Do you want to continue ?"<<endl;
getline(cin,in);//taking input from the user...
if(in=="y"||in=="Y"||in=="yes"||in=="OK"||in=="Why not?")//conditions..
cout<<"OK"<<endl;
else if(in=="No")
cout<<"terminating"<<endl;
else
cout<<"Bad input"<<endl;
return 0;
}
Explanation:
I have taken a string in.
Then taking input from user.
Checking the conditions using if else if ladder.
Answer:
I think it's false
Explanation:
I don't think so. What makes me hesitate is that you may have been told that in your text or in the classroom.
Here are the steps as I understand them.
- Understand the problem you are trying to solve.
- Design a solution.
- Draw a flow chart.
- Write pseudo-code.
- Write code.
- Test and debug.
I think you've done the designing long before you start writing code or even pseudo-code.
Answer:
The answer is (b). 1.
Explanation:
In the code there is only 1 base case .
the base case is as following:-
if(n==0)
return 0;
this is the base case.
Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.
// Writing a C++ function
void PrintShampooInstructions(int numCycles){
if(numCycles < 1) // if condition stands
cout<< "To few";
else if(numCycles >4)
cour<<"Too Many";
else{
// looping the variable for desired out put
for(int i=0;i<numCycles;i++)
cout<<i<<":"<<" Lather and rinse."<<endl;
}
}