| | |
Add two numbers
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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?
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





