
Introduction to C++ Programming: Basics and Structure
"Explore the fundamentals of C++ programming language, including its syntax, structure, input/output statements, and how to compile and execute C programs. Learn about C++ as a versatile object-oriented language and its origins. Get started with a simple program and understand the process of compiling and running C++ code using Turbo C. Dive into the world of C++ programming with this comprehensive guide."
Uploaded on | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
CPP Programming Language PROF. S. LAKSHMANAN, DEPT. OF B. VOC. (SD & SA), ST. JOSEPH'S COLLEGE.
CONTENT Programming Structure INPUT/OUTPUT Statement Simple program Compile and Execution
What is CPP language? C++ is a general-purpose object-oriented programming (OOP) language It is an extension of the C language It is therefore possible to code C++ in a "C style" or "object-oriented style." . It was renamed C++ in 1983.
CPP Programming Structure C++ program structure is divided into various sections Headers Class definition Member functions Member definitions Main function
Input / Output Statement Input Statement: cin>> standard input stream ( Read) Syntax: cin >> variable_name >> The extraction operator(>>) is used along with the object cin for reading inputs. Example: cin>> n ; Read the single value cin>>n>>m ; Read the multiple value
Input / Output Statement OUTPUT Statement: COUT << standard Output stream ( Write) Syntax: cout<< Variable_name The data needed to be displayed on the screen is inserted in the standard output stream (cout) using the insertion operator (<<). Example: cout<< n ; Write the single value cout<<n<<m; Write the multiple value
Simple Program: Example Program: /* Return the Hello World string in CPP */ /save hello.cpp #include <iostream.h> // header file void main( ) // Main function { cout << Hello World! ; // Write the string }
Compile & Execute C Program: Open turboc and type the program. Press F2 Save the file as hello.cpp Compile the program using Alt + F9 OR Compile > Compile Press Ctrl + F9 to Run (or select Run > Run in menu bar ) the C program. Alt+F5 to view the output of the program at the output screen. You will be able to see "Hello World!" printed on the screen
Simple Program: Example:2 /* Addition of Two Number*/ #include <iostream.h> //Header file #include <conio.h> void main() { int a,b; // declartion part clrscr(); // clear the old output on screen cout<< Enter the number a ; //print the string cin>>a; // read the value cout<< Enter the number b ; // print the string cin>>b; // read the value cout<< The Addition of (A+B)= <<(a+b); // write the a,b value getch() //wait press key }