Tuesday, May 25, 2010

C++ Programming

Alot of people think that programming is really hard. I would like to explain it to show how easy it is. When I put // it will mean things after that is explaining.


#include //basically just sets up the program

int main() //makes the main section of code
{ //starts everything in main

float pi = 3.14159; //makes a variable that holds 5 decimal places, name = pi, value = 3.14159
float pi2; //makes another decimal variable which will then hold pi times 2

pi2 = pi*2; //multiplies pi times 2

std::cout << pi2 <<"\n"; //std::cout tells it to print, pi2 shows pi2, \n makes new paragraph

system("PAUSE"); //waits for you to close the box
return 0; //just a thing needed to finish the program
} //ends the section called main.

you must always have a ; after each line except when using {} and int main() and #include .

For feedback I would just like to know how well you understand this now that it is broken down a bit. It was written in C++ coding.

No comments:

Post a Comment