Mari belajar asas c++

View previous topic View next topic Go down

Mari belajar asas c++

Post  Adminscream on Tue Oct 13, 2009 3:50 pm

#include<iostream.h>
void main()
{
int a;
cout<<”Sila Masukkan Satu Nombor:”;
cin>>a;
cout<<”Nombor yang dimasukkan ialah:”<<a;
cout<<endl;
}


#include<iostream.h> // preprocessor

void main() // main function

{ // starting function body
char name[10];
const int Year=2009; // define variable
int YearBorn,Age;

cout<<"This program is use to calculate your age"<<endl; // show output to user "This program is use to calculate your age"

cout<<"and determine whether you are qualify to vote"<<endl; // show output to user "and determine whether you are qualify to vote"

cout<<endl<<"Please key-in your name : "; // endl is use to show output in new line
// show output to user "Please key-in your name"

cin.getline(name,20); // data will key in to variable name and cannot over than 20 letters

cout<<endl<<"YearBorn : "; // show output to user "YearBorn"

cin>>YearBorn; // data will key in to variable YearBorn

cin.get(); // cin.get is use for variable interger and to recall back data

Age=Year-YearBorn; // calculate age

cout<<endl<<"Hello, "<<name<<endl<<"You are "<<Age<<" years old."<<endl; // show output to user "Hello" and recall data from variable name and in new line show output "You are" and recall data from variable age and show output " years old."

if(Age>21) // selection structure where's age must over than 21

cout<<"You are qualify to vote!"<<endl; // show output to user "You are qualify to vote!"

else // selection structure else if user under 21

cout<<"Sorry, You are not qualify to vote!"<<endl; // show output to user "Sorry, You are not qualify to vote!"

cout<<"Thank you for using this program!"; // show output to user "Thanks you for using the program!"

} // ending function body

Adminscream

Posts : 18
Join date : 2009-10-12
Age : 27
Location : GroundHell

View user profile http://masa.forumotion.com

Back to top Go down

C++

Post  Adminscream on Tue Oct 13, 2009 3:51 pm

Boleh cuba pakai ni : http://www.bloodshed.net/devcpp.html

atapun Microsoft Visual C++ Express

Adminscream

Posts : 18
Join date : 2009-10-12
Age : 27
Location : GroundHell

View user profile http://masa.forumotion.com

Back to top Go down

ni ade Video ZTutorial Sekali

Post  Adminscream on Tue Oct 13, 2009 3:52 pm

http://rapidshare.com/files/149040960/1 ... oWorld.rar
http://rapidshare.com/files/149042003/2 ... iables.rar
http://rapidshare.com/files/149043935/3 ... tement.rar
http://rapidshare.com/files/149043550/4 ... _gates.rar
http://rapidshare.com/files/149044174/5 ... rLoops.rar
http://rapidshare.com/files/149044992/6 ... hmetic.rar
http://rapidshare.com/files/149045152/7 ... _Codes.rar
http://rapidshare.com/files/149046324/8_Cpp_Arrays.rar
http://rapidshare.com/files/149046405/9_switch.rar
http://rapidshare.com/files/149047075/10_goto.rar
http://rapidshare.com/files/149047605/11_2d_Arrays.rar
http://rapidshare.com/files/149048005/1 ... _procs.rar
http://rapidshare.com/files/149048220/13_procs.rar
http://rapidshare.com/files/149048206/1 ... _procs.rar
http://rapidshare.com/files/149048407/15_const.rar
http://rapidshare.com/files/149048969/1 ... arrays.rar


Pasword:tbdteam


http://210.48.146.76/~ahaqnet/70_C__.rar

Adminscream

Posts : 18
Join date : 2009-10-12
Age : 27
Location : GroundHell

View user profile http://masa.forumotion.com

Back to top Go down

Re: Mari belajar asas c++

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum