xilica
05-22-2002, 05:20 PM
Yo, how's it going?
Adding the Interface:
In this tutorial I will guide you through writing your first Visual C++ Application!!
To get started load Microsoft Visual C++. When it loads up, click:
File-->New
A dialog box is displayed. Here, Select Win32 Console Application. Under the Project Name (which is on the right side of this dialog box) type: Hello World. Now, click OK. Another dialog box loads. Simply click Finish. After you click Finish another box pops up. Simply click OK.
After all that is done. Click the menu bar named:
Project-->Add to Project-->New.... Select C++ Source File and on the right side of the box under Name type Hello World.
Adding the Code:
In the white area of the document enter this code:
#include <iostream>
#include <string>
using namespace std;
int main () {
string name;
cout << "Hello World. What is your name?";
cin >> name;
cout << "Hello,"
<< name << ". Have a good day."
<< endl;
return 0;
}
Once you are finished typing the code into the edit window we are going to execute your program. Locate the button which looks like a huge ! (exclamation mark). A box will appear. Press OK to this. Your code should execute as many times as you want. All you have to do is press that huge ! (exclamation mark).
Analyzing the Code:
The first two lines of <iostream> and <string> mean that you will include these in your program. the IO in the iostream means input and output. A string, which you are including, is a series of 0 or more characters. These characters can be number of lettets. When you type the code that the user sees, notice that you put "cout" for it. The words "cout" and "cin" mean that it is being outputted and inputted. Notice how you put "<<" when you are coding something the user sees and ">>" when you are coding something the machine will interpret. After the user types his/her name it will then take that name and display with the sentence in which you want it to.
Congratulation on completing and coding your first Visual C++ tutorial.
note: Please feel free to add anything to this posts whether it may be positives or negatives.
Adding the Interface:
In this tutorial I will guide you through writing your first Visual C++ Application!!
To get started load Microsoft Visual C++. When it loads up, click:
File-->New
A dialog box is displayed. Here, Select Win32 Console Application. Under the Project Name (which is on the right side of this dialog box) type: Hello World. Now, click OK. Another dialog box loads. Simply click Finish. After you click Finish another box pops up. Simply click OK.
After all that is done. Click the menu bar named:
Project-->Add to Project-->New.... Select C++ Source File and on the right side of the box under Name type Hello World.
Adding the Code:
In the white area of the document enter this code:
#include <iostream>
#include <string>
using namespace std;
int main () {
string name;
cout << "Hello World. What is your name?";
cin >> name;
cout << "Hello,"
<< name << ". Have a good day."
<< endl;
return 0;
}
Once you are finished typing the code into the edit window we are going to execute your program. Locate the button which looks like a huge ! (exclamation mark). A box will appear. Press OK to this. Your code should execute as many times as you want. All you have to do is press that huge ! (exclamation mark).
Analyzing the Code:
The first two lines of <iostream> and <string> mean that you will include these in your program. the IO in the iostream means input and output. A string, which you are including, is a series of 0 or more characters. These characters can be number of lettets. When you type the code that the user sees, notice that you put "cout" for it. The words "cout" and "cin" mean that it is being outputted and inputted. Notice how you put "<<" when you are coding something the user sees and ">>" when you are coding something the machine will interpret. After the user types his/her name it will then take that name and display with the sentence in which you want it to.
Congratulation on completing and coding your first Visual C++ tutorial.
note: Please feel free to add anything to this posts whether it may be positives or negatives.