![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Beginning C++ | ||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
Beginning C++ | ||||||||||||||||||||||||||||||
C++ is a computer programming language written in text and compiled into an executable program.. We will start off by taking a look at some basic C++ commands. It is strongly recommended that you read all information contained on the home page before continuing. #include <iostream.h> the command above should be at the very beginning of your program. this is a file which is essential for your program to function properly so just make sure this is at the beginning of your code. #include <stdlib.h> this file is much the same thing just make sure it is present at the beginning of your code for your program to function properly. Yor compiler may add things like "using namespace std;" and may put things in the brackets after int main. Do not delete these words, they will come in use later on. int main() this is your main function. A function is a block of code that accomplishes a task. Every program must have a main function and it can have functions within the main function. The int stands for interger which means the input of the function must be an interger (number). { this is the opening bracket, it belongs at the start of the program. Cout << "your text here"; what you see above is a command for output which is usually the screen so anything you write after this in quotation marks will appear on your screen. In this case the sentence "your text here" will appear so you can replace that with your own output. cout << "your text here" << end1; cout << "your text here\n"; << end1; and \n"; are two ways to end a line of text so if you want something to appear on the next line you would end it as shown and then write another cout << and your text after that would appear on the next line. system("pause"); return 0; } system("pause"); and return 0; are necessary to display your program properly and make it run. The bracket at the end is the end of your program. |
||||||||||||||||||||||||||||||
Input, Output and Variables | ||||||||||||||||||||||||||||||
Operators | ||||||||||||||||||||||||||||||
Looping | ||||||||||||||||||||||||||||||
Variables | ||||||||||||||||||||||||||||||
Functions | ||||||||||||||||||||||||||||||
Here is what your program should look like by now | ||||||||||||||||||||||||||||||
#include <iostream.h> #include <stdlib.h> int main() { cout << "your text here\n"; system("pause"); return 0; } |
||||||||||||||||||||||||||||||
Compile your program and fix the errors (if there are any) and then | ||||||||||||||||||||||||||||||
click here | ||||||||||||||||||||||||||||||
if you would like to download a program that should be similar to the one you made |