How do I write a program prompting the user for two inputs, where the inputs must be added together along with branching code to determine whether or not the answer is above 50. Below 50 will indicate that the number is 'too low' and above 50 will indicate that the number is 'too high'.
1
Expert's answer
2011-10-11T08:01:03-0400
#include <iostream> using namespace std; main(){ int a,b,c; cout<<"Please, enter a number:"\r\n; cin>>a; cout<<"Please, enter one more number:"\r\n; cin>>b; c = a+b; if (c<50) cout<<"too low"<<\r\n; if (c>50) cout<<"too high"<<\r\n; }
Comments
Leave a comment