Thread: Help me!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    8

    Question Help me!

    I really need some help.
    First of all, I am new to C++ and I think it's great but
    for all the complier errors I get I deserve to die.
    So first of all, I want to know of a good compiler
    that is very simple and it will show me what line the
    error is and perhaps tell me what kind of error it is.

    Second of all, I want to know if this has any errors.
    It's supposed to be calculator program. I made it myself.

    Code:
    #include <iostream.h>
    
    int main()
    
    int mult(int x, int y);
    
    int divi(int x, int y);
    
    int add(int x, int y);
    
    int sub(int x, int y);
    
    int muvi(int x, int y, int z);
    
    int ch;
    
    {
       
       cout<<"Press 1 for multiplication, 2 for division, 3 for addition, 4 for subtraction,5 to multiply then divide: ";
    
       cin>>ch;
    
       if(ch==1)
    
       {   
          
          int x, y;
          
          cout<<"Please input 2 numbers to be multiplied!: ";
          
          cin>>x>>y;
    
          cout<<"Your answer is...drumroll please..."<<mult(x, y)
       
          return 0;
       
       }
    
       int mult(int x, int y);
       
       {
       
          return x*y;
       
       }
       
       else if(ch==2)
       
       {
       
          int x, y;
       
          cout<<"Please input 2 numbers to be divided!: ";
       
          cin>>x>>y;
    
          cout<<"Cutting up your numbers....answer.."<<divi(x, y);
       
          return 0;
       
       }
       
       int divi(int x, int y);
       
       {   
       
          return x/y;
       
       }
    
       else if(ch==3)
    
       {
       
          int x, y;
       
          cout<<"Please input 2 numbers to be added!: ";  
       
          cin>>x>>y;
    
          cout<<"Squishing them together..."<<add(x, y);
       
          return 0;
       }
    
       int add(int x, int y);
    
       {
    
          return x+y;
    
       }
    
       else if(ch==4)
    
       {
    
          int x, y;
    
          cout<<"Please input 2 numbers to be subtracted!: ";
    
          cin>>x>>y;
    
          cout<<"Your answer is"<<sub(x, y);
    
          return 0;
    
       }
    
          int sub(int x, int y);
    
       {
    
          return x-y;
    
       }
    
       else if(ch>=5)
    
       {
       
          int x, y, z;
          
          cout<<"Please input a number, then a number to multiply it by, then 1 more to be divided by: ";
          
          cin>>x>>y>>z;
    
          cout<<"Your answer is"<<muvi(x, y, z);
       
          return 0:;
         
       }
    
          int muvi(int x, int y, int z);
    
       {
    
          return x*y/z;
    
       }
    Thanks in advance!
    By the way, these forums are really convienent!

    This was done with the help of the C++ Tutorials 1-4.
    Last edited by Chib; 12-07-2002 at 02:56 PM.

Popular pages Recent additions subscribe to a feed