You are on page 1of 7

PROGRAMING

a. Create 2 simple Mathematic operator function using C++ programming language


software.
- first simple Mathematic is Multiply

- Second simple Mathematic is divider

b. Explain programing C++ that you create (operation)


I.
II.
III.
IV.
V.

# = A hash sign (#) are directives for the pre-processor.


#include = The directive #include tells the pre-processor to include a standard file.
iostream.h = Header that defines the standard input/output stream objects and used
for cout.
Int main() = The main function is the point by where all C++ programs start their
execution, independently of its location within the source code.
cout = The standard output, normally the screen.

VI.

<< = The bitwise left shift (<<) shifts operator bits to the left.

VII.

Hello World\n"; = In fact, this statement performs the only action that generates a
visible effect in our first program. A statement is a simple or compound expression
that can actually produce some effect.
\n = (new line) Moves the active position to the initial
position of the next line.
= the separation between statements is specified with an ending semicolon (;) at the
end of each one, so the separation in different code lines does not matter at all for this
purpose.
return 0; = The return statement causes the main function to finish

VIII.
IX.

X.

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>
#include <stdlib.h>

int main()
{
int m, n, total;
std::cout <<"\n Masuk nilai m:";
std::cin >> m;
std::cout <<"\n masuk nilai n:";
std::cin >> n;

total= m/n;

std::cout <<"\n nilai m/n ialah =" << total;

system("PAUSE");
return 0;
}

4. Run the project

5. Save the file under project 3

6. Compilation process

7. Excute the program

8. Insert the data

9 Result

You might also like