distracted
Active Member
- Joined
- Jun 26, 2009
- Sythe Gold
- 0
- Messages
- 127
I began reading a PDF version of C++ Primer-Fourth Edition and am stuck on an exercise.
1) Write a program to print the larger of two inputs supplied by
the user.
This is what I have so far. Please clarify what I am doing wrong; don't simply post the correct code.
Thanks.
1) Write a program to print the larger of two inputs supplied by
the user.
This is what I have so far. Please clarify what I am doing wrong; don't simply post the correct code.
Code:
#include <iostream>
using namespace std;
int main()
{
int x, y;
cout << "Enter two numbers to determine which one is greater";
cin >> x >> y;
if (x > y)
{
cout << x "is the greater variable" ;
}
else
{
cout << y "is the greater variable" ;
}
return 0;
}
Thanks.



