Lab Work No. 2: European University of Lefke Faculty of Engineering Department of Computer Engineering
Lab Work No. 2: European University of Lefke Faculty of Engineering Department of Computer Engineering
Faculty of Engineering
Department of Computer Engineering
int main() {
float values[5];
float sum = 0;
sum += values[i];
std::cout << "Sum of the values: " << sum << std::endl;
return 0;
#include <iomanip>
int main() {
int integers[5];
int smallest;
smallest = integers[0];
smallest = integers[i];
return 0;
#include <cmath>
#include <iomanip>
int main() {
int n, m;
double result;
std::cin >> n;
std::cin >> m;
std::cout << n << "^" << m << " = " << result << std::endl;
return 0;
#include <iomanip>
int main() {
char choice;
switch(choice) {
case '5':
break;
case '6':
break;
default:
} while(choice != '2');
return 0;
}
2b. #include <iostream>
#include <iomanip>
int main() {
char choice;
do {
switch(choice) {
case '3':
break;
case '4':
std::cout << "Exiting program...\n";
break;
default:
} while(choice != '2');
return 0;
#include <iomanip>
int main() {
char choice;
do {
switch(choice) {
case '7':
break;
case '8':
break;
default:
} while(choice != '2');
return 0;
#include <iomanip>
int main() {
char choice;
do {
//
switch(choice) {
case '1':
break;
case '2':
break;
case '3':
break;
default:
} while(choice != '3');
return 0;
3. #include <iostream>
#include <iomanip>
int main() {
char choice;
do {
switch(choice) {
case '+':
std::cout << "Enter first number: ";
std::cout << "Result: " << std::fixed << std::setprecision(2) << result << std::endl; // Formatting the
output
break;
case '-':
std::cout << "Result: " << std::fixed << std::setprecision(2) << result << std::endl; // Formatting the
output
break;
case '*':
std::cout << "Result: " << std::fixed << std::setprecision(2) << result << std::endl; // Formatting the
output
break;
case '.':
default:
} while(choice != '.');
return 0;