Login to Account Create an Account
Posted 29 December 2002 - 02:24 PM
Posted 29 December 2002 - 02:32 PM
hope to see some great programs coming out of you
I tried to learn C++ but the guy was like arab so I couldn't understand a word!!!!
Posted 29 December 2002 - 02:37 PM
read number to A
put A*2 in A
first, the program start's.
than, the program take a number from the user, and put it on the variable A.
than, the program change A to A*2/
than, the program write A on the screen.
than, the program end's.[/b]
Posted 29 December 2002 - 03:22 PM
Type this program to the C++ compiler:
using namespace std;
now run it (press Ctrl+F9), enter a number, and press Enter. you will return to the editor. In order to see the program results, run the program again. (if you have visual C++, press F5 to run the program)
now I will explain the program:
using namespace std;
this part tells the program to use the file "iostream". this file contain's the basic commands you will need. every command in C++(and many another programming languages) must end with ";", so don't forget to put it.
this command start's the program's boddy. after the program finish's the "include" part, it goes to the "main" part, and does the command's there. this line doesn't end with ";", becouse it's a function (I will explain about function's in more advance lesson's), and it will only end when it will reach to "}".
this command creates a new variable from the type integer, and give it the name "A". when we will want to use that variable, we use the name A. integer's are complete numbers, so you can't put fraction's in it.
the "cin" command take's informatio from the users, and put it in variables. before every variable you want to put data in, you type ">>".
this command put's the data in the right side ("A*2" in this case), to the variable in the left side ("A").
the "cout" command print's data on the screen. the data can be variable, phrase, a number or text. before every data you want to print on the screen, you type "<<".
in order to end the "main" part (or any another block), you need "}". after the "}", you don't put ";".
Posted 30 December 2002 - 04:44 AM
Posted 30 December 2002 - 12:55 PM
Posted 03 January 2003 - 04:22 AM
its not really that simple now is it.i dont expect any from here to learn enough to make worthy program
Posted 03 January 2003 - 04:32 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users