You are on page 1of 1

{int number; cout << "" ; cout << "" ; int num1 = 0; char again = 'y';

while(again == 'y' || again == 'Y')

cout << "\n\n Check whether a number is positive or negative: \n";

cout << "\n\n ------------------------------- \n";

cout << "input a number \n";

while(!(cin>>num1))

cout << "It needs to be a number \n";

cin.clear();

cin.ignore(numeric_limits<streamsize>::max(), '\n');

if (num1==0)

cout << "Number inputed is zero \n";

if (num1>0)

cout << "Number inputed is positive \n";

if (num1<0)

cout << "number inputed is negative \n";

else

cout<< "Thank you \n";

cout<<"Want to go again? (y/n) \n";

cin >> again;

} break;

You might also like