








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The first lecture of a programming fundamentals course. It covers the history of C++ and its relationship with C, the C++ standard library, and basic programming concepts such as input/output and functions. The lecture also includes sample code for a 'Hello World' program and an 'Add Integer' program.
Typology: Slides
1 / 14
This page cannot be seen from the preview
Don't miss anything!









Welcome Course Syllabus Tentative Schedule An Important Note to the Students Introduction
OOP – Object Oriented Programming
C++ History
C++ Std Library
C++ Development Environment
Other details
Down to Business
Statements end with a semicolon ; Pre-processor directive is excluded \ is an escape sequence \n new line \t tab \r cursor to beginning of current line \a sound alert \ used to print backslash character \’ single quote character \” double quote character
1 // Fig. 1.6: fig01_06.cpp 2 // Addition program. 3 #include 4 5 // function main begins program execution 6 int main() 7 { 8 int integer1; // first number to be input by user 9 int integer2; // second number to be input by user 10 int sum; // variable in which sum will be stored 11 12 std::cout << "Enter first integer\n"; // prompt 13 std::cin >> integer1; // read an integer 14 15 std::cout << "Enter second integer\n"; // prompt 16 std::cin >> integer2; // read an integer 17 18 sum = integer1 + integer2; // assign result to sum 19 20 std::cout << "Sum is " << sum << std::endl; // print sum 21 22 return 0 ; // indicate that program ended successfully 23 24 } // end function main Declare integer variables. Use stream extraction operator with standard input stream to obtain user input. Stream manipulator std::endl outputs a newline, then “flushes output buffer.”On some systems where outputs accumulate in the machine until there are enough to make it display on the screen.It forces any accumulated aoutput to be displayed at that moment Concatenating, chaining or cascading stream insertion operations. Calculations can be performed in output statements: alternative for lines 18 and 20: std::cout << "Sum is " << integer1 + integer2 << std::endl;
Reading Material
Edition, pp