| | |
Add two numbers
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
i need help for an engineering class is this the correct syntax for this type of program to add two numbers together i need help at the line that says here this is for a c++ source file
// program
#iomanip
#iostream
include namespace std;
void main()
{
int number1,number2;
char answer;
cout<<"number1";
cin>>"number1";
cout>>"number2";
cin>>"number2";
answer=number1+number2
here> cout<<char<<answer<<endl;
}
// program
#iomanip
#iostream
include namespace std;
void main()
{
int number1,number2;
char answer;
cout<<"number1";
cin>>"number1";
cout>>"number2";
cin>>"number2";
answer=number1+number2
here> cout<<char<<answer<<endl;
}
•
•
Join Date: Feb 2003
Posts: 129
Reputation:
Solved Threads: 1
Hi Joe,
Fishman has given you some useful code their to get you going. Note that your own code has several basic syntax errors, which indicate that you're probably still at the "hello world" stage. Do you have a C++ book to refer to? If not, can you lay your hands on one for a little while? It'll help you enormously.
You can also find some (limited but) helpful stuff here:
http://www.robertjacobs.fsnet.co.uk/
Note that if you're using Visual C++ you'll probably have to add:
return 0;
just before the end of the main() function if you use fishman's code, otherwise you might get a compilation error.
Fishman has given you some useful code their to get you going. Note that your own code has several basic syntax errors, which indicate that you're probably still at the "hello world" stage. Do you have a C++ book to refer to? If not, can you lay your hands on one for a little while? It'll help you enormously.
You can also find some (limited but) helpful stuff here:
http://www.robertjacobs.fsnet.co.uk/
Note that if you're using Visual C++ you'll probably have to add:
return 0;
just before the end of the main() function if you use fishman's code, otherwise you might get a compilation error.
![]() |
Similar Threads
- Add numbers from text file (C++)
- how to add two numbers using algorithm? (Assembly)
- How to make a program that uses fstream to add numbers to a .txt file? (C++)
- add two numbers in embedded C (C)
- Need Help. Add Two Ascii Numbers? (Assembly)
- add two numbers (PHP)
- how do i add the numbers in a listbox and display it in another textbox? (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: problem with my program!!
- Next Thread: How do you add animation to visual C++ program?
Views: 17920 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





