Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //My first day of C++ Programming...
- // pgm1.cpp - My C++ program
- #include<iostream> //include in/output of the actual program
- using namespace std; //include namespace so you don't have to keep using std:: before the functions in the class
- int _age; //global variable that can be used throughout the scope of the program
- int main() //scope of program
- {
- /*
- int x = 0;
- char y;
- float z;
- long a;
- double b; //these are variables
- std::cout<< "int x = " << sizeof(x) << std::endl;
- std::cout<< "char y = " << sizeof(y) << std::endl;
- std::cout<< "float z = " << sizeof(z) << std::endl;
- std::cout<< "long a = " << sizeof(a) << std::endl;
- std::cout<< "double b = " << sizeof(b) << std::endl;
- //std can be removed as it's added throughout the scope of the entire program
- std::cin.get();
- cout<<"hello, how old are you?: ";
- cin >> _age; //age is entered here
- cout<< "You are: "<<_age <<" years old";
- cin.get();
- cin.get();
- */
- cout<<"Enter your age: "; //cout = text outputted to console
- cin >> _age;
- int date = 2014; //int is allocated to 4 bytes in memory in RAM
- int outcome;
- outcome = date - _age;
- cout<<"You were born in the year: " << outcome;
- cin.get(); //Waits for user input
- cin.get();
- return 0;
- }
- //I already knew a lot of the stuff already, but thought I would share. :D
- //BaSs_HaXoR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement