You need to Register First!

Before you Log-in...

Part of a C++ Syntax HON
You need to Register First!

Before you Log-in...

Part of a C++ Syntax HON
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  PortalPortal  GalleryGallery  SearchSearch  Latest imagesLatest images  RegisterRegister  Log inLog in  
Sample design and thinking of Something new Graphical design.... To all member's of this website please Fill up the form of your Personal Information for Special Reference of our Forum thank you!
For non-member just post your comment in the chatbox. Thanks for Visiting our site.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Latest topics
» AutoCAD-tutorial-01
Part of a C++ Syntax Icon_minitimeThu Dec 13, 2018 3:49 pm by Kuteshikimi

» Definition-of-Computer-Graphics
Part of a C++ Syntax Icon_minitimeThu Dec 13, 2018 3:47 pm by Kuteshikimi

» Explore-the-Graphical-User-Interface
Part of a C++ Syntax Icon_minitimeThu Dec 13, 2018 3:44 pm by Kuteshikimi

» A-BRIEF-HISTORY-OF-COMPUTER-GRAPHICS
Part of a C++ Syntax Icon_minitimeThu Dec 13, 2018 3:42 pm by Kuteshikimi

» Lesson 7- Network Design Models
Part of a C++ Syntax Icon_minitimeSun Nov 25, 2018 2:29 am by Kuteshikimi

» Lesson 6-Internet and Networking Devices
Part of a C++ Syntax Icon_minitimeSun Nov 25, 2018 2:27 am by Kuteshikimi

» Lesson 5-Introduction to Data Communications
Part of a C++ Syntax Icon_minitimeSun Nov 25, 2018 2:26 am by Kuteshikimi

» Lesson 4-Network Cabling
Part of a C++ Syntax Icon_minitimeSun Nov 25, 2018 2:19 am by Kuteshikimi

» Lesson 3-Types of Internet Connection
Part of a C++ Syntax Icon_minitimeSun Nov 25, 2018 2:19 am by Kuteshikimi

ENGINEERING.COM GAMES
Top 100 Games
Game Site Top 100


Most active topic starters
Kuteshikimi
Part of a C++ Syntax Vote_lcapPart of a C++ Syntax Voting_barPart of a C++ Syntax Vote_rcap 
imbaBOY
Part of a C++ Syntax Vote_lcapPart of a C++ Syntax Voting_barPart of a C++ Syntax Vote_rcap 
Top posters
Kuteshikimi
Part of a C++ Syntax Vote_lcapPart of a C++ Syntax Voting_barPart of a C++ Syntax Vote_rcap 
imbaBOY
Part of a C++ Syntax Vote_lcapPart of a C++ Syntax Voting_barPart of a C++ Syntax Vote_rcap 
markeeh17
Part of a C++ Syntax Vote_lcapPart of a C++ Syntax Voting_barPart of a C++ Syntax Vote_rcap 
Top posting users this month
No user
Top posting users this week
No user
Visitor’s Unique Page-View
Visitor Counter
Visitor Counter
Visitor’s
free counters
Globe

 

 Part of a C++ Syntax

Go down 
AuthorMessage
Kuteshikimi
Admin
Admin
Kuteshikimi


Posts : 52
Join date : 2011-09-01
Age : 33
Location : Cavite City, Philippines

Part of a C++ Syntax Empty
PostSubject: Part of a C++ Syntax   Part of a C++ Syntax Icon_minitimeFri Jul 06, 2012 8:09 am

 PREPROCESSOR DIRECTIVES

To start off, we have the preprocessor directives at the topmost part of C++ program. This is where all functions are imported or, in C++ terms, “included”. Without it you won’t be able to execute any command at all, since commands are always included from other functions. This is very important because without it, the command getch() will not execute properly since it was imported from conio.h.

Code: #include <conio.h>


conio stands for “console input/output” an “H-file” because its extension is .h
“h” signifies a header file.

Code: #include<iostream.h>


iostream stands for input/output an “H-file” because its extension is .h
“h” signifies a header file.



 FUNCTIONS
Are lines of code grouped that performed several tasks in a program. They are easily recognizable because names are immediately followed by parenthesis. The number of functions found in a C++ program can range from 1 to as many as the user desires.
The main() function, as long as main() is present , the program will still compile and run- assuming all the codes inside the main() functions can stand on their own and are not cross-referencing other functions.


 DATA TYPES
When we declare variables, we also declare the variables data type and determines what kind of values it can store within itself. When a program that has a variable declared within it is run, OS reserves memory locations to hold these variables.


DATA TYPES CODE EXAMPLE
integer int 1,2,3,4,5,6...
float float 13.1,3.14..
character char A,b,c,d,e…

• INTERGER – holds whole number.
• FLOAT- holds decimal numbers.
• CHARACTER –can store single character.

VARIABLE AND CONSTANT

• Variable- Change values throughout the program- you can think of variables as containers whose contents can change and be accessed for future use.
(HOLDS SINGLE VALUE)

• Constant - should be given initial values. Retain that same value throughout the program; values cannot be change during the execution of the program.
(FIXED VALUE)

• Identifier – is the variable name, or how you present it in your program code.
Example. studentsAge, grade;

Rules in declaring variables or naming identifiers :
1.) Identifier can only contain letters, numbers, dollar sign($), and underscore.
2.) Identifier cannot start in numbers.
3.) If the identifier is consist of two or more words, the words must be considered as one, by making them connected with underscore, or just remove the spaces.
4.) Identifiers are case sensitive.


EXAMPLE OF IDENTIFIER

VALID INVALID
num1 1num
numOne num one
$econdName3 myN@m?
your_Name yo-ur/Na*me
fName float
love2love "love,love"


 STATEMENTS

A statement is an instructional code that commands the computer to do certain action upon its execution. A semicolon ( signifies the end of an statement. The declaration of a variable in a function is also considered as a statement since the entire line of code ends with a semicolon.

 COMMENTS

Comments- are lines of code that are not executed during the program. They are used either to give a brief labeling and explanation to lines of codes or to temporarily disable lines of code during the development phase. There are two kinds of comments that C++ utilizes.
• Single-line Comment – a double slash (//) at the beginning of a line of code disables the entire statement and considers it merely as a comment
• Multi-line Comment – several lines of code can be disabled by placing the code block between a slash- asterisk (/*) and an asterisk-slash (*/)

Example of variable declarations “int studentsAge”; where int is a data type
And studentsAge is the variable.

CODING GUIDELINES

 Use comments for documentation and readability.
 White spaces are ignored.
 Indent for readability .


 THE COUT AND CIN STATEMENTS

cout - statement outputs all the variables or constants that are declared in it.

Syntax: cout <<“C++ is cool!\ n”;

cin – statement asks for an input from the user. Create a new C++ program with the following lines of code and observed what happens;

#include <iostream.h>
#include <conio.h>

main()
{
int int1;
cout<<“\n Enter an integer : \n”;
cin>>int1;
cout<<int1;
getch();
return 0;
}
Back to top Go down
https://kuteshikimi.board-directory.net
 
Part of a C++ Syntax
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: FORUM :: Application Program :: C++-
Jump to: