#include <iostream>
using namespace std;
int main()
{
int n1, n2, sum;
cout << "welcome to my arithmetic program!";
cout << "enter 2 integer: ";
cin >> n1 >> n2;
sum = n1+n2;
cout << "sum is" << sum << std::endl;
}
next program
int main()
{
int number1; // first integer to compare
int number2; // second integer to compare
cout << "Enter two integers to compare: "; // prompt user for data
cin >> number1 >> number2; // read two integers from user
cin.ignore();
if ( number1 == number2 )
cout << number1 << " == " << number2 << endl;
if ( number1 != number2 )
cout << number1 << " != " << number2 << endl;
if ( number1 < number2 )
cout << number1 << " < " << number2 << endl;
if ( number1 > number2 )
cout << number1 << " > " << number2 << endl;
if ( number1 <= number2 )
cout << number1 << " <= " << number2 << endl;
if ( number1 >= number2 )
cout << number1 << " >= " << number2 << endl;
cin.get();
using namespace std;
int main()
{
int n1, n2, sum;
cout << "welcome to my arithmetic program!";
cout << "enter 2 integer: ";
cin >> n1 >> n2;
sum = n1+n2;
cout << "sum is" << sum << std::endl;
}
next program
int main()
{
int number1; // first integer to compare
int number2; // second integer to compare
cout << "Enter two integers to compare: "; // prompt user for data
cin >> number1 >> number2; // read two integers from user
cin.ignore();
if ( number1 == number2 )
cout << number1 << " == " << number2 << endl;
if ( number1 != number2 )
cout << number1 << " != " << number2 << endl;
if ( number1 < number2 )
cout << number1 << " < " << number2 << endl;
if ( number1 > number2 )
cout << number1 << " > " << number2 << endl;
if ( number1 <= number2 )
cout << number1 << " <= " << number2 << endl;
if ( number1 >= number2 )
cout << number1 << " >= " << number2 << endl;
cin.get();
0 comments:
Post a Comment