|
Post by Blaine on Jul 29, 2005 2:34:36 GMT -5
Lesson one "Hello world" application.
Source
#include<iostream> using namespace std;
int main() { cout << " Hello world"; return 0; }
#include<iostream> - allows for the use of cout and cin.
using namespace std; - makes its so yo dont have to put std:: infront of cout and cin.
int main() is the main function and all the code within the brackets defines it.
cout << - console output
"Hello World";- Prints whatever is within the " " the semicolon ends a statement in c++. People Just starting out usualy forget to use this.
return 0; - ends the progam
|
|
|
Post by Blaine on Jul 29, 2005 16:58:12 GMT -5
Lesson 2 - "Converting Tempatures"
formula for celsius to Fahrenheit- Fahrenheit = (celsius * 1.8) + 32
variable types
(Name) (Examle)
(int) (10) (Char) ('c') (String) ("this is a string") (bool) (true) (double) (1.0) (long) (10L) (short) (27)
source-
#include <iostream> using namespace std;
int main () { double ctep, ftemp; cout << "Input a Celsius Tem and press ENTER: " cin >> ctemp; ftemp = (ctemp * 1.8) + 32; cout<< "Fahrenheit temp is: " << temp; return 0; }
cin - allows for you to enter the double ctemp
|
|