IT Community Malaysia

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: C++ Review


Smasher Hax

Status: Offline
Posts: 267
Date:
C++ Review
Permalink  
 


#include <iostream.h>

main ()

{

int nCode;

cout << " Please Insert Your Code: \n ";

cin >> nCode;

 

if (nCode = 101)

cout << "Welcome User 101 \n";

else if (nCode = 202)

cout << "Welcome User 202 \n";

else if (nCode = 303)

cout << "Welcome User 303 \n";

 

system("pause");

return 0;

}

 

Description:

This is a simple C++ Programming Coding. This program tutor is not to describe how this program work. But this tutor just want to show you about the simple coding.

The #include <> is the command that you want to use the file (The file of the command). In this tutor, we use file iostream.h because the command cout and cin is in iostream.h file. Some Programming C software they are not accepting if you re use iostream.h, but you must use just iostrem only. It is mean, the coding is like this: #include <iostream>. Some mathematical programming they will use #include (cmath).

The main () command is to tell the program that the coding is the main. If in the HTML coding, main command is refer to <body>...</body> command. Than, after you have noticed the main(), you must insert the programm coding is all about.

int nCode is the title of the next coding. What is the nCode do, (the nCode is like to be a trademark or naming the value).

cout is command of c out. It's command is to prompt a message. To use this command, we have to use it like this: cout << "Your Message Here!"; . The symbol of ";" is to tell the programm that your cout is end there. The command \n is to tell the programm that your message is at the new line.

cin is command of c in. It's command is to record the feedback value when the user entering to cout command. To use this cin is like this: cin >> [your call to the value- naming value]; . Every each command, we must put ";", it is mean that is the break command.

if statement is to make the programm can be choose or do something if something are happen. To use the statement is like this: if ([your naming value here] = [what value]); . The program run like this, if value 101 are put, then the prgram will show the next cout for giving some message. C Programming is not likely to Microsoft Visual Basic Programming. It is because, the Ms Visual basic, the if statement are running like this : if... then, else... then, end if. It is mean, it should coded like this:

if button1_click then,

(Something happen here)

elseif button2_click then,

(something goes here)

end if

But in C Programming, you can put the else if as many as you want. There is no end if to use.

The system() command is to tel the program to do something. In this example, we use pause command. It is mean, the program will pause before to go to return 0;.  Return 0; is mean the program exiting.

 

This is the simple description. If you have a better description, let us know it.

If you having problem in Programming C, just share here. We will help you what we can do.

Thank you.

 



__________________

I am Sharper

ITC - Internet Moderators

Mods Name: KA



Newbie

Status: Offline
Posts: 2
Date:
Permalink  
 

At college where I'm studying assignments of the kind were quiet popular being a part of our C++ programming essentials course. To me, it looks like a pert of a homework assignment. If that's so, and an instant help from professional or somebody just to pay online for the programming project is your primary objective, here is where I do my coding homework and suggest you to explain your issue to representatives of this service. I'm confident in their services and therefore am certain that you task will be solved fast.



__________________
Page 1 of 1  sorted by
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard