0% found this document useful (0 votes)
3 views15 pages

C++ Arithmetic Operations Exercises

The document is an evaluative activity focused on solving arithmetic operations using the C++ programming language. It includes exercises with code examples, program outputs, and analyses of results, aiming to enhance understanding of arithmetic operators and programming structure. The conclusion emphasizes the importance of programming in organizing technological processes effectively.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views15 pages

C++ Arithmetic Operations Exercises

The document is an evaluative activity focused on solving arithmetic operations using the C++ programming language. It includes exercises with code examples, program outputs, and analyses of results, aiming to enhance understanding of arithmetic operators and programming structure. The conclusion emphasizes the importance of programming in organizing technological processes effectively.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

EVALUATIVE ACTIVITY AXIS 2


SOLVING ARITHMETIC OPERATIONS WITH C++ LANGUAGE

LAURA NATALÍ MANRIQUE SEPÚLVEDA

GROUP 072 NCR - 6856

JAVIER AUGUSTO RIOS

ANDINA UNIVERSITY FOUNDATION

FACULTY OF ENGINEERING AND BASIC SCIENCES

INDUSTRIAL ENGINEERING PROGRAM

VIRTUAL MODE

NOVEMBER 1, 2021
2

TABLE OF CONTENTS

INTRODUCTION................................................................................................................................3
OBJECTIVES........................................................................................................................................4
General............................................................................................................................................4
Specific.....................................................................................................................................4
FIRST EXERCISE5
Program in C++ language5
Program result (compile and run)......................................................................6
SECOND EXERCISE....................................................................................................................7
Program in C++ language7
Program result (compile and execute)8
THIRD EXERCISE.
Program in C++ language.........................................................................................................9
Program result (compile and run)
FOURTH EXERCISE......................................................................................................................11
Analysis of program results12
Program result (compile and run)....................................................................13
conclusions14
BIBLIOGRAPHY15
3

INTRODUCTION

Programming in computer science refers to the creation or processes used to devise,


organize, design software that will be executed through programs, computers or
platforms. this concept becomes among many, something of vital importance for the
human being, because through programming we can have an order of activities
what we are going to do. Through tools like programming languages, we
allows for a greater success in the objectivity of programming in the world
technologically everyday. Its main function is to write programs that allow the
user-machine communication, through a set of instructions, orders, actions
consecutive data and algorithms provided by a programmer.

The programming language C++, founded in 1979 by Bjarne Stroustrup, focuses on


carry out high-level structured programming with high performance, such as operating systems,
machines among others. Through the development of this we will learn about the function and concepts

basics of the C++ language, and through specific examples will be developed
programs through a C++ language compiler and in turn, we will be able to correct
possible errors that may arise in given instructions or programs.
4

OBJECTIVES
General

Identify the hierarchy of arithmetic operators and understand the structure in


programming with C++ language.

Specific

1. Develop arithmetic exercises through programming in C++ language

2. Analyze the structure of the instructions used in compilers for

programming with C++ language.


5

FIRST EXERCISE

x=8+2*5/2-1

x = 8 + 10 / 2 - 1

x= 8 + 5 - 1

x = 13 - 1

x = 12

Program in C++ language

#include <cstdio>
#include <conio.h>
#include <iostream>

using namespace std;

int main (int argc, char *argv)


{
float x;
Hello, I will help you solve your arithmetic exercise.
x = 8.0 + 2.0 * 5.0 / 2.0 - 1.0;
cout << 'The result is: ' << x;

getch();
return 0;

}
6

Result of the program (compile and run)

Figure 1. Result of arithmetic operation 1


7

SECOND EXERCISE

x = (4 * 8 * (4 + (8 * 4 / (3))))
x = (4 * 8 * (4 + (32 / 3)))
x = (4 * 8 * (4 + (32 / 3)))
x = (4 * 8 * (4 + 10.66666667))
x= (4 * 8 * 14.66666667)
x= 469.333

Program in C++ language

#include <cstdio>

#include <conio.h>

#include <iostream>

using namespace std;

int main (int argc, char *argv [])

float x;

cout << "Welcome, I will help you find the value of x.\n";
x = (4.0 * 8.0 * (4.0 + (8.0 * 4.0 / (3.0))));

The result is:

It was a pleasure to help you.

getch ();

return 0;

}
8

Program output (compile and run)

Figure 2. Result of arithmetic operation 2


9

THIRD EXERCISE

x = 4 + 5 * (9 * (5 - (8 + 4) / 6))
x = 4 + 5 * (9 * (5 - 12 / 6))
x = 4 + 5 * (9 * 3)
X = 4 + 5 * 27
X = 4 + 135
X= 139

Program in C++ language

#include <cstdio>

#include <conio.h>

#include <iostream>

using namespace std;

int main (int argc, char *argv [])

float x;

This program will help you solve your math operation.

cout << "Let's find the value of x.\n";

x = 4.0 + 5.0 * (9.0 * (5.0 - (8.0 + 4.0) / 6.0));

The result is:

It was a pleasure to help you.

getch ();

return 0;

}
10

Program output (compile and run)

Figure 3. Result of arithmetic operation 3


11

FOURTH EXERCISE

Figure 4. Execution of the program in C++ language

Figure 5. Program result.


12

Analysis of program results


We can verify that the program ran when we compiled and executed it.
obtaining as a result the sample of the instructional message
AREANDINA

The instruction lines //cout<<"WHAT IS YOUR NAME;";

//cin>>name;

Your name is:

They are found as comment lines within the program. The lines that start
with two slash signs are considered comments and have no effect on the
program behavior (Flores, 2008).

However, at the time of removing these slash signs from the instructions of
program given in the exercise, we can see that the program runs with more
success, allowing the user to enter the requested data, in this case the name of the
user.

Correction of instructions

#include<iostream>

using namespace std;

int main ()

string name;

AREANDINA

HOW DO YOU CALL YOURSELF;

cin >> name;

cout << "YOUR NAME IS:" << name;

}
13

Result of the program (compile and run)

Figure 6. Program result.


14

CONCLUSIONS

Daily, we continue to make giant strides in technology-related topics.


therefore, it is very convenient to apply and implement actions or tools that allow us
better organize these technological processes. For this, it is necessary to continue applying the
existing programming languages and even improving them, as this not only does it
will ensure that the things we use in our daily life work in a
correct way, but it will also help us to control everything in an organized manner
whatever requires programming.
15

BIBLIOGRAPHY

(Flores, 2008) Obtained from C++ Language Programming Manual, Project of


Research: Radial Basis Function Methods for the Solution of PDEs:
Unable to access or translate content from the provided URL.
(Casas, n.d.) Obtained from Reference of Thought Axis 2, Basic Programming Language C+
+ History C++ Foundation University student del Area Andean:
Unable to access the content of the specified URL.

You might also like