I am a newbie in programming, I am using Microsoft visual c++ express edition to learn the basics. I want to know the keywords for entering data and also the keyword for displaying result, (like the INPUT and PRINT in the old BASIC). I used cin and cout, but the program ended up having errors. It didn't accept the cin and cout keywords. I am trying to make a simple program to accept a value as input, do some mathematical operations and display the result.
This is my project
#include %26lt;iostream%26gt;
#include "stdafx.h"
#include %26lt;sstream%26gt;
#include %26lt;string%26gt;
int main()
{
int c;
cin %26gt;%26gt; c;
int total = c + 100;
cout %26lt;%26lt; total %26lt;%26lt; end1;
return 0;
)
Also a simple but detailed tutorial would be helpful. If you know any links please post it.
I need help with Microsoft visual C++ 2005......?
In between the lines:
#include %26lt;string%26gt;
int main()
Type the line:
using namespace std;
A namespace is just an organizational thing. Everything in the standard library of functions and such that come with the C++ language are defined inside a namespace called "std", which stands for "standard". Without that line you would've had to type something like:
std::cout %26lt;%26lt; total %26lt;%26lt; std::endl;
This isn't something you'll really have to worry about, just remember to include that line "using namespace std;" in your programs.
Also, the line:
cout %26lt;%26lt; total %26lt;%26lt; end1;
end1 should be endl (lowercase L)
endl stands for "end line".
Here's a tutorial I've used before:
http://www.cprogramming.com/tutorial.htm...
gift baskets
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment