You are on page 1of 5

JS 5 Fundamental of C++

1.Open programming C++

2. Select new source file

3. Write this program

/* This is a program That computes the sum of two integer


number */
# include < iostream.h>
Main ()
{
int X , Y , sum ;
cout <<\nEnter first number : ;
cin >> X ;
cout <<\nEnter second number : ;
cin >> Y;
sum = X + Y ;
cout << \nsum =<< sum ;
return 0;

4. Run the project

5. Save the file under Project 1

6. Compilation process

1. How to

a.

Compilation process

Compiling a source code file in C++ is a four-step process. For example, if you have a C++ source code
file named prog1.cpp and you execute the compile command
g++ -Wall -ansi -o prog1 prog1.cpp

the compilation process looks like this:


1. The C++ preprocessor copies the contents of the included header files into the source code file,
generates macro code, and replaces symbolic constants defined using #define with their values.
2. The expanded source code file produced by the C++ preprocessor is compiled into the assembly
language for the platform.
3. The assembler code generated by the compiler is assembled into the object code for the platform.
4. The object code file generated by the assembler is linked together with the object code files for
any library functions used to produce an executable file.

b. Execute the program


To execute a program you need to type these codes down
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int input;
cout << "Enter 1 to execute program." << endl;
cin >> input;
if(input == 1) /*execute program here*/;
return 0;
}

2. What is C++ Programming


It is designed with a bias toward system programming (e.g., for use in embedded
systems or operating system kernels), with performance, efficiency and flexibility of use as its design
requirements. C++ has also been found useful in many other contexts, including desktop
applications, servers (e.g. e-commerce, web search or SQL servers), performance-critical
applications (e.g. telephone switches or space probes), and entertainment software.[3] C++ is
a compiled language, with implementations of it available on many platforms and provided by
various organizations, including the FSF, LLVM, Microsoft and Intel.
C++ is standardized by the International Organization for Standardization (ISO), with the latest (and
current) standard version ratified and published by ISO in December 2014 as ISO/IEC
14882:2014 (informally known asC++14).[4] The C++ programming language was initially
standardized in 1998 as ISO/IEC 14882:1998, which was then amended by the C++03, ISO/IEC
14882:2003, standard. The current C++14 standard supersedes these and C++11, with new
features and an enlarged standard library. Before the initial standardization in 1998, C++ was
developed by Bjarne Stroustrup at Bell Labs, starting in 1979, who wanted an efficient flexible
language (like the C language), which also provided high-level features for program organization.

You might also like