Visual C++ 2008 - First Console
Page 1 of 1 • Share •
Visual C++ 2008 - First Console
Today is the day i started learning C++ so i will write something on here when i learn something new.


now there is going to open a screen hit next and click on empty project.
(ure empty project will be created!)
Right click on the folder called "Source files" -> "Add" -> "New Item..."

insert this code into ure main.CPP:
explaining:
<iostream> = input output stream
cout = Console output
<< = to separate some parts
now if you click on debug -> start without debugging.

it will show up like this:

(dont mind the dutch text bellow it, it says hit any button to continue.)
now we go to the next step: (so we can enter something in it)
change the code to this:
Explaining:
int = integer it means you can only enter digits like (12 17 1 19 80) you cant enter 14.5 13.2 or something like that
iAge = i means that it uses an declared as an int and age is just to remember it (You could type there what ever you like iAge is simple to remember its an Int and you use it for the Age)
cin = Console input
>> = means it has to wait for you to put something in to the val iAge
it would look like this:

then if you enter something i will enter 17 and then hit enter it will change to this:

Thanks for reading, more will come soon.
Robin
Have fun.


now there is going to open a screen hit next and click on empty project.
(ure empty project will be created!)
Right click on the folder called "Source files" -> "Add" -> "New Item..."

insert this code into ure main.CPP:
- Code:
#include <iostream>
void main() {
std::cout << "Hello Programmer" << std::endl;
}
explaining:
<iostream> = input output stream
cout = Console output
<< = to separate some parts
now if you click on debug -> start without debugging.

it will show up like this:

(dont mind the dutch text bellow it, it says hit any button to continue.)
now we go to the next step: (so we can enter something in it)
change the code to this:
- Code:
#include <iostream>
void main(){
std::cout << "Hello Programmer" << std::endl;
std::cout << "What is ure age? " << std::endl;
int iAge;
std::cin >> iAge;
std::cout << "So ure age is: " << iAge << std::endl;
}
Explaining:
int = integer it means you can only enter digits like (12 17 1 19 80) you cant enter 14.5 13.2 or something like that
iAge = i means that it uses an declared as an int and age is just to remember it (You could type there what ever you like iAge is simple to remember its an Int and you use it for the Age)
cin = Console input
>> = means it has to wait for you to put something in to the val iAge
it would look like this:

then if you enter something i will enter 17 and then hit enter it will change to this:

Thanks for reading, more will come soon.
Robin
Have fun.

Robin- Moderator

- Number of posts: 11
Age: 18
Location: Holland
Registration date: 2008-08-31
Permissions of this forum:
You cannot reply to topics in this forum





