0% found this document useful (0 votes)
6 views5 pages

Programming of Computer Equipment: Assignment Works-1

The document outlines an assignment for programming computer equipment, detailing tasks that involve writing programs to display personal information, perform arithmetic operations, and generate a formatted table of calculations. It includes example code for each task and explanations of specific programming concepts. The assignment requires submission of the source code, algorithms, and conclusions along with screenshots of the programs in action.

Uploaded by

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

Programming of Computer Equipment: Assignment Works-1

The document outlines an assignment for programming computer equipment, detailing tasks that involve writing programs to display personal information, perform arithmetic operations, and generate a formatted table of calculations. It includes example code for each task and explanations of specific programming concepts. The assignment requires submission of the source code, algorithms, and conclusions along with screenshots of the programs in action.

Uploaded by

4848alp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PROGRAMMING OF COMPUTER EQUIPMENT

Assignment Works-1

Group E-ET-1

Performed by: Alp INAN

KAUNAS, 2024
1 Task no.1
1.1 Task description

Assignment Tasks:
1. Based on Example 1.1, write a program that: a) Displays your name, surname, group name, and
school name on separate lines. b) Investigate what the line cin >> x; does. What would happen if
this line were removed?
2. Based on Example 1.3, write a program that: a) Displays your name and surname above the
calculation results instead of "John Doe." b) Performs all basic arithmetic operations (+, –, *, /,
%), and displays the results in int, float, and double types. c) Submit a report with screenshots
(PrintScreen) of your program. The first input number should be 1000 * variant_number, and the
second number should be 3 * variant_number.
3. Write a program that generates a table for the input of three numbers. The table should be well-
aligned with visible borders and corners. Calculate the division of each number by 3, displaying
the quotient, remainder, and full division result.
4. Submit a report including the completed assignment tasks, the program's source code,
algorithms, and conclusions..

1.2 Program code

1.Task code Example 1.1

#include <iostream>
using namespace std;

int main() {
int x;
cout << "alp" << '\n';
cout << "inan" << '\n';
cout << "ET1-1" << '\n';
cout << "Lietuvos inzinierius kolegija";
cin >> x;
return 0;
}

2. Task Code Example 1.2

#include <iostream>
using namespace std;

int main() {
int num1, num2;
int intResult;
float floatResult;
double doubleResult;

cout << "Alp INAN" << '\n';

cout << "Enter the first number (1000 * variant_number): ";


cin >> num1;
cout << "Enter the second number (3 * variant_number): ";
cin >> num2;

int value1, value2;

2
value1 = 1000 * num1;
value2 = 3 * num2;

intResult = value1 + value2;


floatResult = (float)value1 + value2;
doubleResult = (double)value1 + value2;
cout << "Addition results: " << '\n';
cout << "int result = " << intResult << '\n';
cout << "float result = " << floatResult << '\n';
cout << "double result = " << doubleResult << '\n';

intResult = value1 - value2;


floatResult = (float)value1 - value2;
doubleResult = (double)value1 - value2;
cout << "\nSubtraction results: " << '\n';
cout << "int result = " << intResult << '\n';
cout << "float result = " << floatResult << '\n';
cout << "double result = " << doubleResult << '\n';

intResult = value1 * value2;


floatResult = (float)value1 * value2;
doubleResult = (double)value1 * value2;
cout << "\nMultiplication results: " << '\n';
cout << "int result = " << intResult << '\n';
cout << "float result = " << floatResult << '\n';
cout << "double result = " << doubleResult << '\n';

intResult = value1 / value2;


floatResult = (float)value1 / value2;
doubleResult = (double)value1 / value2;
cout << "\nDivision results: " << '\n';
cout << "int result = " << intResult << '\n';
cout << "float result = " << floatResult << '\n';
cout << "double result = " << doubleResult << '\n';

intResult = value1 % value2;


cout << "\nModulus result: " << '\n';
cout << "int result = " << intResult << '\n';

return 0;
}

3.Task Code Example 1.3

#include <iostream>
using namespace std;

int main() {
int num1, num2, num3;

cout << "Enter the first number: ";


cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
cout << "Enter the third number: ";
cin >> num3;

int q1 = num1 / 3, r1 = num1 % 3;


int q2 = num2 / 3, r2 = num2 % 3;

3
int q3 = num3 / 3, r3 = num3 % 3;

cout << "\n\t----------------------------------------------------------------\n";


cout << "\t| Number | Quotient | Remainder | Full Result |\n";
cout << "\t----------------------------------------------------------------\n";
cout << "\t| " << num1 << "\t\t | " << q1 << "\t | " << r1 << "\t | " << (float)num1 / 3 << "\t|\
n";
cout << "\t----------------------------------------------------------------\n";
cout << "\t| " << num2 << "\t\t | " << q2 << "\t | " << r2 << "\t | " << (float)num2 / 3 << "\t|\
n";
cout << "\t----------------------------------------------------------------\n";
cout << "\t| " << num3 << "\t\t | " << q3 << "\t | " << r3 << "\t | " << (float)num3 / 3 << "\t|\
n";
cout << "\t----------------------------------------------------------------\n";

return 0;
}

1.3 Comments and conclusions

For Example 1.1 Question B:


b) Investigate what the line cin >> x; does. What would happen if this line were removed?
The line of cin >> x takes data from user and keep in mind it in x. Without this line, the program
will terminate immediately after displaying the output because it waits for user input to proceed. If
this line is removed, the program will close after showing the output, giving no chance for the user
to interact.

For Example 1.2 Question C:


c) Submit a report with screenshots (PrintScreen) of your program.

4
For Example 1.3 Results:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy