Help with C++!!

Discussion in 'Software' started by training4life, Dec 13, 2005.

  1. training4life

    training4life Sergeant

    I need someone to make this program for me...

    Using the different arithmetic operators create a C++ program that will ask the user to enter two numbers and when the user press the Enter key will display the sum, difference, product, quotient and modulus of the two numbers. Always use the first number as the first operand and the second number as the second operand. The output of your program should be as follows:

    Good day!
    This program will ask you to enter 2 numbers and after entering these two numbers it will display the sum, difference, product, quotient and modulus of the number you have given.

    Enter the first number: 10  this will be entered by the user
    Enter the second number: 2  this will be entered by the user
    The sum of the numbers you entered is 12
    The difference of the numbers you entered is 8
    The product of the numbers you entered is 20
    The quotient of the numbers you entered is 5
    The modulus of the numbers you entered is 0

    Thank you for using this program!
     
  2. QuickSilver

    QuickSilver Corporal

    Is there anything in particular you're having trouble with in the scope of the (what looks like) programming homework you've been given?
    Most people here would be happy, and more than willing to help with troubles you're having with learning C++, and how to approach problems, but less inclined to jump in and write your homework for you. That doesn't really benefit anyone.

    In terms of a C++ course, I'd say this is sort of puzzle is at the low end, possibly week 1 or 2 in a course teaching from scratch... there are fundamentals here which need to be grasped if you're interested in learning the language.
     
  3. thagentleman

    thagentleman Private E-2

    #include <iostream>
    using namespace std;
    int main ()
    {
    int a;
    int b;
    int c;
    cout<<"Enter 1st number">>endl;
    cin>>a;
    cout<<"Enter 2nd number">>endl;
    cin>>b;
    c=a+b;
    c=a-b;
    c=a*b;
    c=a/b;
    c=a%b;
    system ("pause");
    }

    something like that.
     
  4. rmStar-R

    rmStar-R Private E-2

    This is quite late but yes. Thagentleman is right. All you need now are the cout lines. Example:
    Code:
    cout << "<proper discription>" << c << endl;
    for every after the assignment lines
    Code:
    c = <...>
     
  5. training4life

    training4life Sergeant

    Gee! Thanks! :D
     
  6. Wyatt_Earp

    Wyatt_Earp MajorGeek

    LOL...

    Well, QuickSilver. Good try at least. Personally, I wouldn't have written the whole program for him. :p
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds