The document provides instructions for a C++ programming assignment involving creating two mathematical operator functions and explaining a sample C++ program. It includes definitions for key elements of the C++ program like preprocessor directives, iostream library, main function, functions, output streams, and return statements. It also provides step-by-step instructions for running the sample C++ program, which calculates the sum of two user-input numbers.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
263 views
Presentation Assignment Programming
The document provides instructions for a C++ programming assignment involving creating two mathematical operator functions and explaining a sample C++ program. It includes definitions for key elements of the C++ program like preprocessor directives, iostream library, main function, functions, output streams, and return statements. It also provides step-by-step instructions for running the sample C++ program, which calculates the sum of two user-input numbers.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8
PRESENTATION ASSIGNMENT
1. PROGRAMMING a. Create 2 simple mathematic operator function using C++ software.
*Plus mathematical
*Minus mathemtical
b. Explain program C++ that you create (operation).
1) # * A hash sign are directive for the pre-processor. 2) #include * Lines beginning with a hash sign (#) are directive for the preprocessor. The directive #include <iostream> tells the preprocessor to include the iostream standart file. 3) Iostream.h * iostream.h is the C++ programming object inherit all member from both instream (instream) and ostream. It for perform both input and output operations. 4) Int main() *to beginning of the definition of the main function. The function is the point by where all C++ program start their execution,indepently of its location within the source code. 5) Function *allow to structure program in segments of code to perform individual tasks. 6) Cout *cout represent the standart output stream in C++ and the meaning of the entire statement is insert a sequence of character . 7) << *the bitwise left shift to shift operator bits to the left. 8) \n *moves the active position to the initial position of the next line. 9) ; *the separation between statement is specified with an ending semicolon at the end of each one sentences. 10) Return 0; *the return statement cause the main function to finish. Return may be followed by a return code (in our example is followed by return code 0). A return code of 0 for the main function is generally interpreted as the program worked as expected without any errors during its execution.
C. Give your answer step by step how to run that program.
1. Open programming C++
2. Select new source file
3. Write this program
#include <iostream.h> #include <stdlib.h> Int main() { Int X, Y, sum ; Std::cout <<\nEnter first number :; Std::cin >> X ; Std::cout <<\nEnter second number :; Std::cin >> Y ; Sum = X + Y ; Std::cout <<\nsum = << sum ; System (PAUSE) ; Return 0; }