Engineering in Kenya

The Programming Language for the C++ Editor

Posted by on Jul 16, 2018 in Physics | 0 comments

300x250 animated The Programming Language for the C++ Editor

The Programming Language for the C++ Editor needs translation. An algorithm is an ordered set of unambiguous, executable steps defining a terminating process. An algorithm is used when preparing to write a program for a particular specification. It is then translated to Programming Language for the C++ Editor. Engineering in Kenya has more information.

An example of a Program Written in the Programming Language for the C++Editor

// p11.cpp – This program will compute the profit of selling soft drinks

paydot 468x60 The Programming Language for the C++ Editor

#include <iostream>

Using namespace std;

Int main ( )

{

Int cases_per_day, bottles_pre_day;

Int bottles_per_day = 12;

Double profit_per_bottle = 40; //40 shillings per bottle profit

Double profit_per_day, profit_per_year;

Cout <<”press enter after entering each number n”;

Cout<< “enter number of cases n”;

Cin >> cases_per_day;

Profit_per_day = cases_per_day*bottles_per_cases*profit_per_bottle;

Profit_per_year = 365*profit_per_day;

Cout << “the shop has made:”;

Cout << profit_per_day;

Cout << “  per day. n”;

Cout << “that means the profit for one year will be:”;

Cout << profit_per_year << end1;

Cout << “good business?! n”;

Return 0;

}

Programming Language for the C++ The Programming Language for the C++ EditorTranslation of Programming Language for the C++ Editor

On the first line we have:

paydot 468x60 The Programming Language for the C++ Editor

// p11.cpp – This program will compute the profit of selling soft drinks

The // in Programming Language for the C++ Editor tells the compiler that the line is only a comment and do not participate in the computing. Comments are added for readability and/or to describe parts of a program.

On the next line we have:

#include <iostream>

This is called an include directive in Programming Language for the C++ Editor. It tells the compiler where to find information about some of the items that are used in our program, for example: cout, <<, >>, and cin in the above program. There are other libraries that one can use to include other items. Note that the directive always begins with #.

Using namespace std;

This line in the Programming Language for the C++ Editor will tell the compiler that the names defined in iostream are to be interpreted in a standard way.

Int main ( )

{

This in the Programming Language for the C++ Editor marks the beginning of the main program. The type ‘int’ is used for type ‘integer’, main is a function name and ( ) will mark the boundary of parameters. The { marks the beginning of the main function and the } will mark the end of it. For every {, one should have a corresponding }.

In the next four lines:

Int cases_per_day, bottles_pre_day;

Int bottles_per_day = 12;

Double profit_per_bottle = 40; //40 shillings per bottle profit

Double profit_per_day, profit_per_year;

This is where we declare the variables that we plan to use in Programming Language for the C++ Editor, and we also define their type. In the above four lines, ‘int’ is used to declare variables of type integer. On the second line we not only define the bottles_per_case as an integer, we also initialize it to 12. On the third and fourth lines, we have defined variables of type double. Note that each instruction is ended with a semi colon.

On the following two lines:

Cout <<”press enter after entering each number n”;

Cout<< “enter number of cases n”;

We have used cout to display a message on the screen. The cout statement will allow us to direct data from a variable out to the screen in Programming Language for the C++ Editor.

Cin >> cases_per_day;

The cin in Programming Language for the C++ Editor is used to to direct data from the keyboard into a variable. It is important and very easy to remember what the direction of << and>> is. When we send data to the screen, we send it to cout so the direction must be << and when we send data from the keyboard to a variable using cin, the direction must be towards the variable >>.

In the sample program, we have performed some calculations:

Profit_per_day = cases_per_day*bottles_per_cases*profit_per_bottle;

Profit_per_year = 365*profit_per_day;

In the first line, we have multiplied cases per day by bottles per case by profit per bottle and stored the result into profit per day.

Conclusion on the Programming Language for the C++ Editor

There are other different editors, and arithmetic operators, but this is the translation of the Programming Language for the C++ Editor.