•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,488 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,734 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 805 | Replies: 2
![]() |
| |
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
This is my code below:
I'm starting out...obviously, a newbie here. However, I cannot understand that when I run this code with the first number being 34 and my second number being 40 ....I get the output of 39.
This is not my homework. I'm just trying to learn on my own for now.
Thanks for all you help.
Sincerely,
St!tch.
cplusplus Syntax (Toggle Plain Text)
using namespace std; int main(int argc, char *argv[]) { int thisisanumber; int SecondNumber; int TotalNumber; TotalNumber = thisisanumber + SecondNumber; cout<<"Please enter a number: "; cin>> thisisanumber; cin.ignore(); cout<<"You entered: "<< thisisanumber <<"\n"; cin.get(); cout<<"Please enter a second number: "; cin>> SecondNumber; cin.ignore(); cout<<"Your second number is: "<< SecondNumber <<"\n"; cin.get(); cout<<"Your Total is: "<< TotalNumber <<"\n"; cin.get(); cout<<"Thank you for your patience with my new small but mighty program!"; cin.ignore(); }
This is not my homework. I'm just trying to learn on my own for now.
Thanks for all you help.
Sincerely,
St!tch.
Last edited by Ancient Dragon : Sep 12th, 2007 at 3:32 am. Reason: add code tags
And I can't understand how 99% of new posters can fail to read the intro threads properly (or at all).
http://www.daniweb.com/forums/announcement8-3.html
Or completely ignore the watermark at the back of the edit window.
Or fail to press "preview" to make sure their post is going to come out right.
Or fail to read other peoples posts and wonder, "hey, I wonder how they got the code all nice?".
http://www.daniweb.com/forums/announcement8-3.html
Or completely ignore the watermark at the back of the edit window.
Or fail to press "preview" to make sure their post is going to come out right.
Or fail to read other peoples posts and wonder, "hey, I wonder how they got the code all nice?".
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,541
Reputation:
Rep Power: 40
Solved Threads: 972
•
•
•
•
I'm starting out...obviously, a newbie here. However, I cannot understand that when I run this code with the first number being 34 and my second number being 40 ....I get the output of 39.
This is not my homework. I'm just trying to learn on my own for now.
Thanks for all you help.
Sincerely,
St!tch.
Move line 8 down to line 21. Code is executed in the order that it appears in the program, which means the two numbers can not be added together until after their values are known.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Adding numbers (Python)
- adding numbers in tk (Python)
- Code line numbers - causing paste problems (DaniWeb Community Feedback)
- C Program for Adding two numbers without using + sign (C)
- Finding Perfect Numbers. "help plz" (C++)
- error while adding two numbers (C#)
- How many different numbers are there? (C++)
- Command line calculator (C)
- what does this code do? (PHP)
Other Threads in the C++ Forum
- Previous Thread: Variable scope problem
- Next Thread: lnk2019 error



Hybrid Mode