Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //include
- #include <iostream>
- using namespace std;
- //show off functions that aren't main
- void function();
- //functions
- int main(){
- //variables
- int number;
- double numberwithpoint;
- bool torf;
- char letter;
- //arrays of variables
- int numberarray[];
- double numberwithpointarray[];
- bool torfarray[];
- char letterarray[];
- // testing and loops
- //switch statment
- switch(avariable){
- case something:
- break;
- default:
- //somthing to do
- }
- //if statment
- if(something){
- }
- else if(somthingelse){
- }
- else{
- }
- //while loop
- int i;
- while(i < 10){
- cout << "i is less than 10" << endl;
- i++;
- }
- //do while
- do{
- }while(something);
- //for loop
- for(int var; var <= 42; var++){
- cout << var << endl;
- }
- //in points using goto
- loop:
- //do something
- if(something) goto loop;
- //run you other funtion
- function();
- //return 0 no signal for os to handle after program end.
- return 0;
- }
- //a second function
- void function(){
- //functions stuff
- //print some text on the screen using the iostream libary
- cout << "some text" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement