C++ Fundamental Syntax





Since C++ is an Object Oriented Programming, so its program will consist classes, objects, namespaces, etc...
There will be a so many concepts in subsequent tutorial, here we will see the basic syntax of C++.

C++ First program Using GNU C/C++ compiler :

1. Create the source code:

Open the text editor.

Type the following code and save the file with name "mycode.cpp"

You can save your file at any location in your system, for this example file is saved at Desktop.


//SAVE FILE : mycode.cpp
#include < iostream >
using namespace std;
int main()
{
    cout<<"Hello World!";
    return 0;
}

This example uses a function main, it is called entry point of program. To show output we use cout with << operator.
<< operator use to pass multiple values out to the screen.

2. Compile & Run the code :

Open the terminal ( Command Prompt) and change the working directory to that loacation where you have saved your source file.

For compilation type
g++ mycode.cpp

To run type
./a.out

It will give output
Hello World!

COMPILE :  Open terminal and type the following command
$  g++  mycode.cpp
RUN : $ ./a.out
OUTPUT :
Hello World!    

Compilation/Execution using Dev-C++ IDE

Follow these steps to create, compile and execute the program using Dev-C++

1. Click on File menu option choose New then click on Source File
2. It will open a blank page, write your code here and save your file.
3. Press F9 to compile your code.
4. And then press F10 to execute .

Next topic is data types





 




Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at info@prowessapps.in


Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at info@prowessapps.in


CONTACT DETAILS

info@prowessapps.in
(8AM to 10PM):

+91-9026070669 , +91-9451396824

© 2016, prowessapps.in, All rights reserved