go post it in C++ section
/request move
either way whats the problem?
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.
Im just asking for help so please don't at me callin me a noob and all please.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 ; }
READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT
go post it in C++ section
/request move
either way whats the problem?
You never said what you need help with
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
I don't think you can do that...search google? because that is somethign simple that you can probably get off google
cout << "I'm your calculator, how may i help you?" ;
you are creating an Console app arent you ?
Kodacodez (03-31-2011)
Kodacodez (03-31-2011)
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
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..
Kodacodez (03-31-2011)
works for me
Uploaded with ImageShack.us
lol XD @whit ;p
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
Kodacodez (03-31-2011)
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.works for me
READ BEFOR POSTING A REPLY OR YOUR A AN IDIOT
this
cout << "I'm your calculater, how may I help you?" << endl;"
wasnt even in the code..