This tutorial is basically for people who have never even touched C++ before. First, my notes:
------------------
PROGRAMMING IN c++
VISUAL STUDIO 2008
------------------
=========
VARIABLES
=========
int - Integer 0-9
double - Decimals
char - Single Letter A-Z
string - Word, Phrase, Sentence
bool - True/False
=======
HEADERS
=======
#include<iostream>
#include<VARIABLE NAME> <--Allows use of variable listed
using namespace std;
int main ()
=====================
EXAMPLE "HELLO WORLD"
=====================
#include<iostream>
using namespace std;
int main ()
{
cout <<"Hello World!"<<endl;
system ("Pause");
return 0;
}
cout is text output. << must be before and after text and text must be in quotes. Endl is endline and a semicolon
must be at the end of every line. System refers to the module that is running the program and ("Pause") causes the system to stop what it is doing. Return 0 causes the system to quit. { and } are open and close keys for the C++ program.
=================
EXAMPLE VARIABLES
=================
cout <<"My lucky number is "<<LuckyNum<<endl;
___________________________ ________________
All above this line is text This part is the variable <<LuckyNum<<
*So if your number is 7 then the line will read "My lucky number is 7"
**To place a period after your variable simply insert it as <<VARIABLE<<"."<<endl;
***Remember you must have an extra set of carrots if you add a period.
==================
EXAMPLE USER INPUT
==================
cout <<"What is your favorite number?"<<endl;
cin>>FavNum;
cout<<endl;
cout<<"Your favorite number is "<<FavNum<<"."<<endl;
system ("Pause");
cin is text input. This line requires the user to type a number. The next line will write the number inputted.
=====
HINTS
=====
cout<<endl; <--This is a space between lines.
= means input operator
== means comparison operator
When you first open Visual C++, you'll need to start a new project. Then you'll need to put in the fundamental headers.
#include<iostream>
using namespace std;
int main();
Remember to put
semicolons after namespace std and int main. Some lines need semicolons and some don't. Don't worry about it though; Visual will tell you if you need a semicolon somewhere.
Look at the example "Hello World" and DO NOT COPY AND PASTE IT. Type it out yourself. To test your app, press F5. Visual will compile your program and give you any errors you have at the bottom of the screen.

Notice my error. It's difficult to tell what I did wrong, but when I double click the error it takes me to the open bracket just after int main. This means I did something wrong around here. The error also says "missing function header". The header is int main, so that line is where my problem is. INT MAIN does not need a semicolon. I'll take it out and try running it again, shall I?

Yay! It works! Get used to the DOS box for now; you'll be seeing it a lot.
***Using my notes above, see if you can make a guess the lucky number game. Here's a hint: You'll need two variables. Both are int, and one is luckynumber and the other is luckyinput.