CyberCodes

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull


Sum, Difference, Product and Qoutient in C++

Go down

Admin Post Sum, Difference, Product and Qoutient in C++

Post by princeterror on Fri Jan 11, 2013 11:28 pm

Output:

Enter a high number:
Enter a low number:

"The sum of two numbers is ___________"
"The difference of two numbers is ______"
"The product of two numbers is ________"
"The Qoutient of two numbers is _______"
"The two numbers are _____ and ______"


Answer Codes
Code:
# include <iostream>

using namespace std;

int main()
{
    int a,b;
    cout<<"Enter a high number: ";
    cin>>a;
    cout<<"Enter a low number: ";
    cin>>b;
    cout<<endl;

    cout<<"the sum of the two numbers is "<<a+b<<endl;
    cout<<"The difference of the two numbers is "<<a-b<<endl;
    cout<<"The product of the two numbers is "<<a*b<<endl;
    cout<<"The qoutient of the two numbers is "<<a/b<<endl;
    cout<<"The two numbers are "<<a<<" and "<<b<<endl<<endl;

//system("pause");
return 0;
}


kung gusto nyu naman may mga kulay ang mga titik try nyu to


With Font color:
Code:
# include <iostream>
# include <windows.h>
using namespace std;



int main()
{


    int a,b;
    HANDLE  hConsole;
  hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleTextAttribute(hConsole, 2);
    cout<<"Enter a high number: ";


  SetConsoleTextAttribute(hConsole, 3);
    cin>>a;

  SetConsoleTextAttribute(hConsole, 2);
    cout<<"Enter a low number: ";

  SetConsoleTextAttribute(hConsole, 3);
    cin>>b;
    system("cls");

    cout<<endl<<endl;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<"the sum of the two numbers is ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<a+b<<endl;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<"The difference of the two numbers is ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<a-b<<endl;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<"The product of the two numbers is ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<a*b<<endl;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<"The qoutient of the two numbers is ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<a/b<<endl;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<"The two numbers are ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<a;
    SetConsoleTextAttribute(hConsole, 2);
    cout<<" and ";
    SetConsoleTextAttribute(hConsole, 3);
    cout<<b<<endl<<endl;

//system("pause");
return 0;
}
avatar
princeterror
Universal Moderator
Universal Moderator

Posts : 272
Credits : 11465
Fame : 81
Join date : 2012-06-07
Age : 26

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum