|
-
March 20th, 2009, 01:15 PM
#1
Need help with fixing C++ code?
Ok, here's the thing. I want to have a program that tells the user to enter the height and width of a poster.
Then i want it to (based on the user entered numbers) to tell the user to use A4, A3, A2 or A1 paper. Must reflect portrait and landscape view.
I'm new at C++, and so i want you to tell me what is wrong with the code I have so far, and show me how you fixed it (if you fixed it for me) or tell how to do it on my own.
I only want to use what I know so far for the code, so nothing for advanced C++ please .
Here is the code i have so far:
______
#include <iostream>
using namespace std;
int main()
{
int pos_wid, pos_hei;
cout << "Enter the dimensions of the poster in mm: " << endl;
cin >> pos_wid >> pos_hei;
if (pos_wid => 210 && pos_hei <= 297) || (pos_wid <= 297 && pos_hei => 210)
{
cout << "Use A4" << endl;
}
else if (pos_wid => 297 && pos_hei <= 420) || (pos_wid <= 420 && pos_hei => 297)
{
cout << "Use A3" << endl;
}
else if (pos_wid => 420 && pos_hei <= 594) || (pos_wid <= 594 && pos_hei => 420)
{
cout << "Use A2" << endl;
}
else if (pos_wid => 594 && pos_hei <= 810) || (pos_wid <= 810 && pos_hei => 594)
{
cout << "Use A1" << endl;
}
else
{
cout << "Not in stock" << endl;
}
system("pause>null");
}
______
Oh and please don't laugh if you find a lot of errors , like I said i'm new.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|