Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Kodacodez's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Under your bed ;)
    Posts
    24
    Reputation
    10
    Thanks
    1
    My Mood
    Twisted

    Question [HELP]non-hack related c++

    Ok im working on learning c++ and im working on a calculator atm but i cant get it to say "I'm your calculator, how may i help you?" and i want it go to the next sentince when you hit enter wich would be
    Code:
    cout << " please enter the first number you'd like to calculate " << endl ; // the first number you type in
    :
    then you type it in the number hit enter then +, -, or /. hit enter then it will ask for the 2ed number and you type that in and hit enter and it will add it and display the answer.
    Code:
    // pew pew calculator.cpp : main project file.
    
    #include "stdafx.h"
    #include <iostream>
    using namespace std ;
    int main ()
    {
    
       
       char response ;
       int firstnumber ; 
       int secondnumber ; 
       cout << " please enter the first number you'd like to calculate " << endl ; // the first number you type in
        cin>> firstnumber ; // hit enter
       cout << " please enter which operation you wanna do "<< endl ; // +, -, dev etc.
       cin >> response ; // hit enter agin
       cout << " please enter the second number you'd like to calculate " << endl ; // the second number you type in
       cin >> secondnumber ;
       if (response == '+'){
       cout << firstnumber << " + " << secondnumber << " = " << firstnumber+secondnumber << endl ; 
       };
       if (response == '-'){
       cout << firstnumber << " - " << secondnumber << " = " << firstnumber-secondnumber << endl ; 
       };
       if (response == '*'){
       cout << firstnumber << " * " << secondnumber << " = " << firstnumber*secondnumber << endl ; 
       };
       if (response == '/'){
       cout << firstnumber << " / " << secondnumber << " = " << firstnumber/secondnumber << endl ; 
       cout << " and the remainder fot the devision would be " << firstnumber%secondnumber<< endl ; 
       };
       
       char f ;
       cin >> f ;
       return 0 ;
    }
    Im just asking for help so please don't at me callin me a noob and all please.
    READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT

  2. #2
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,008
    Reputation
    58
    Thanks
    224
    go post it in C++ section
    /request move
    either way whats the problem?

  3. #3
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    You never said what you need help with

  4. #4
    Kodacodez's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Under your bed ;)
    Posts
    24
    Reputation
    10
    Thanks
    1
    My Mood
    Twisted
    Sorry I forgot there was a c++ sec i pretty much stay on CA sec, mod can you please move?
    i need help geting it to say "I'm your calculator, how may i help you?" and hit enter to go to the next line. if that made sence
    READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT

  5. #5
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,008
    Reputation
    58
    Thanks
    224
    I don't think you can do that...search google? because that is somethign simple that you can probably get off google

  6. #6
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    cout << "I'm your calculator, how may i help you?" ;
    you are creating an Console app arent you ?

  7. The Following User Says Thank You to whit For This Useful Post:

    Kodacodez (03-31-2011)

  8. #7
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,008
    Reputation
    58
    Thanks
    224
    Quote Originally Posted by whit View Post
    cout << "I'm your calculator, how may i help you?" ;
    you are creating an Console app arent you ?
    what else would it be?

  9. #8
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by PashaAmd View Post
    what else would it be?
    He could be creating a dll or something

  10. The Following User Says Thank You to whit For This Useful Post:

    Kodacodez (03-31-2011)

  11. #9
    Kodacodez's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Under your bed ;)
    Posts
    24
    Reputation
    10
    Thanks
    1
    My Mood
    Twisted
    Ok Ill look it up, yes atleast I'm trying to.

    every time i do that it wont work when i go to debug it.

    Edit: Ok i got it to say what i want its just the hitting enter part thats not working but Ill see what I can find on google.
    Last edited by Kodacodez; 03-31-2011 at 07:46 PM.
    READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT

  12. #10
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,008
    Reputation
    58
    Thanks
    224
    dude i don't even think it is neccessary to debug it if you can't have it go to the next line..
    just google it..

  13. The Following User Says Thank You to PashaAmd For This Useful Post:

    Kodacodez (03-31-2011)

  14. #11
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    works for me



    Uploaded with ImageShack.us

  15. #12
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,008
    Reputation
    58
    Thanks
    224
    lol XD @whit ;p

  16. #13
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    5,052
    My Mood
    Cool
    char * nothingreally;
    cout >> " I am bla bla bla"
    cin << nothing really// no matter what they put they it is a string.. :P
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  17. The Following User Says Thank You to topblast For This Useful Post:

    Kodacodez (03-31-2011)

  18. #14
    Kodacodez's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Under your bed ;)
    Posts
    24
    Reputation
    10
    Thanks
    1
    My Mood
    Twisted
    works for me
    what im trying to do is make it were you have to hit enter after "cout << "I'm your calculater, how may I help you?" << endl;" appears to make it go to "cout << " please enter the first number you'd like to calculate " << endl ;" if that made anysence.
    READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT

  19. #15
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    this
    cout << "I'm your calculater, how may I help you?" << endl;"

    wasnt even in the code..

Page 1 of 2 12 LastLast