Does anyone want to participate in review?
Come to 205
Come to 205
👍3😢2
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int calculate(int, int);
void swap(int* a, int* b) {
*a = *a+*b;
*b = *a-*b;
*a = *a-*b;
}
void checkEven(int *num) {
if (*num % 2 == 0) {
*num = 0;
}
}
void writeLog() {
ofstream outputFile("log.txt");
if (outputFile.is_open()) {
outputFile << "Finished";
outputFile.close();
}
}
void printMatrix(int matrix[2][3]) {
for (int i = 0; i < 2; i++) {
for (int j=0; j < 3; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
}
int main() {
// bool flag = true;
// int j=5;
// for (j; j<10 and flag; j++) {
// if (j==7) {
// flag = false;
// }
// cout << j << " ";
// }
// not !
// or ||
// and &&
// ifstream inFile("input.txt");
// string word;
// while (inFile >> word) {
// cout << word <<endl;
// }
// ifstream inFile("input.txt");
// string word;
// while (getline(inFile, word)) {
// cout << word <<endl;
// }
// int x = 10;
// checkEven(&x);
// cout<<x;
// p1
// int score = 75;
// if (score>=60) {
// cout<<"Pass";
// }else {
// cout<<"Fail";
// }
// p2
// int i = 10;
// do {
// cout << " "<< i;
// i--;
// }while (i>=7);
// p3
// int a=3, b=4;
// int result = calculate(a, b);
// cout << result << endl;
// p4
// int data[] = {10, 20, 30};
// int sum = 0;
// for (int i=0; i<sizeof(data)/sizeof(int); i++) {
// sum += data[i];
// }
// cout << sum << endl;
// p5
// bool is_raining = true;
// double d=9.8;
// if (!is_raining) {
// cout<<"Sun";
// }else {
// int x = int(d);
// cout<<x;
// }
// double d = 9.17;
// int x = round(d);
// cout<<x<<endl;
// p6
// int num = 42;
// int *ptr = #
// cout<<*ptr;
// p7
// int **arr = new int *[5];
// arr[2] = new int[50];
// delete[] arr;
// p9
// int val = 10;
// int val2 = 20;
// int const * const p = &val;
// p = &val2;
// cout<<&val<<endl;
// cout<<p;
// code 2
// int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};;
// int *ptr = arr;
// int max = *arr;
// for (int* i = arr; i < arr+10; i++) {
// if (*i > max) {
// max = *i;
// }
// }
// int max2 = *ptr;
// for (int* i=arr; i < arr+10; i++) {
// if (*i>max2 and *i<max) {
// max2 = *i;
// }
// }
// cout << max2 << endl;
// sorting
// int n; cout<<"Enter the size of array: "; cin>>n;
// int arr[n];
// for (int i = 0; i < n; i++) {
// cin>>arr[i];
// }
// int *ptr = arr;
// for (int i = 1; i < n; i++) {
// for (int j = 1; j < n; j++) {
// if (*(ptr+j)<*(ptr+j-1)) {
// swap(ptr+j, ptr+j-1);
// }
// }
// }
// int max2 = *(ptr+n-2);
// cout << max2 << endl;
// 3-usul
// int arr2[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
// int *ptr = arr2;
// int max1 = *ptr;
// int max2 = 0;
// for (int i = 0; i < 10; i++) {
// if (max1 < *(ptr+i)) {
// max2 = max1;
// max1 = *(ptr+i);
// }
// }
// cout<<max2<<endl;
return 0;
}
int calculate(int x, int y) {
return x*x + y;
}
#include <cmath>
#include <fstream>
using namespace std;
int calculate(int, int);
void swap(int* a, int* b) {
*a = *a+*b;
*b = *a-*b;
*a = *a-*b;
}
void checkEven(int *num) {
if (*num % 2 == 0) {
*num = 0;
}
}
void writeLog() {
ofstream outputFile("log.txt");
if (outputFile.is_open()) {
outputFile << "Finished";
outputFile.close();
}
}
void printMatrix(int matrix[2][3]) {
for (int i = 0; i < 2; i++) {
for (int j=0; j < 3; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
}
int main() {
// bool flag = true;
// int j=5;
// for (j; j<10 and flag; j++) {
// if (j==7) {
// flag = false;
// }
// cout << j << " ";
// }
// not !
// or ||
// and &&
// ifstream inFile("input.txt");
// string word;
// while (inFile >> word) {
// cout << word <<endl;
// }
// ifstream inFile("input.txt");
// string word;
// while (getline(inFile, word)) {
// cout << word <<endl;
// }
// int x = 10;
// checkEven(&x);
// cout<<x;
// p1
// int score = 75;
// if (score>=60) {
// cout<<"Pass";
// }else {
// cout<<"Fail";
// }
// p2
// int i = 10;
// do {
// cout << " "<< i;
// i--;
// }while (i>=7);
// p3
// int a=3, b=4;
// int result = calculate(a, b);
// cout << result << endl;
// p4
// int data[] = {10, 20, 30};
// int sum = 0;
// for (int i=0; i<sizeof(data)/sizeof(int); i++) {
// sum += data[i];
// }
// cout << sum << endl;
// p5
// bool is_raining = true;
// double d=9.8;
// if (!is_raining) {
// cout<<"Sun";
// }else {
// int x = int(d);
// cout<<x;
// }
// double d = 9.17;
// int x = round(d);
// cout<<x<<endl;
// p6
// int num = 42;
// int *ptr = #
// cout<<*ptr;
// p7
// int **arr = new int *[5];
// arr[2] = new int[50];
// delete[] arr;
// p9
// int val = 10;
// int val2 = 20;
// int const * const p = &val;
// p = &val2;
// cout<<&val<<endl;
// cout<<p;
// code 2
// int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};;
// int *ptr = arr;
// int max = *arr;
// for (int* i = arr; i < arr+10; i++) {
// if (*i > max) {
// max = *i;
// }
// }
// int max2 = *ptr;
// for (int* i=arr; i < arr+10; i++) {
// if (*i>max2 and *i<max) {
// max2 = *i;
// }
// }
// cout << max2 << endl;
// sorting
// int n; cout<<"Enter the size of array: "; cin>>n;
// int arr[n];
// for (int i = 0; i < n; i++) {
// cin>>arr[i];
// }
// int *ptr = arr;
// for (int i = 1; i < n; i++) {
// for (int j = 1; j < n; j++) {
// if (*(ptr+j)<*(ptr+j-1)) {
// swap(ptr+j, ptr+j-1);
// }
// }
// }
// int max2 = *(ptr+n-2);
// cout << max2 << endl;
// 3-usul
// int arr2[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
// int *ptr = arr2;
// int max1 = *ptr;
// int max2 = 0;
// for (int i = 0; i < 10; i++) {
// if (max1 < *(ptr+i)) {
// max2 = max1;
// max1 = *(ptr+i);
// }
// }
// cout<<max2<<endl;
return 0;
}
int calculate(int x, int y) {
return x*x + y;
}
❤1👍1
Computer Programming
mock_final102.pdf
Guys!
I tried my best to prepare this mock.
However, I can not say the real exam will be exactly like this.
So do not think this is a real exam
I tried my best to prepare this mock.
However, I can not say the real exam will be exactly like this.
So do not think this is a real exam
❤8🔥6🕊2
‼️Pay attention ‼️
Tomorrow we are going to organize an extra lesson!
@cpp_sirius👨💻
Tomorrow we are going to organize an extra lesson!
💻 Computer Programming
🗓️ Thursday, 11th December
🕓 Time: 21:00
🧩 File Handling
@cpp_sirius👨💻
❤12👍1🔥1
Computer Programming
‼️Pay attention ‼️ Tomorrow we are going to organize an extra lesson! 💻 Computer Programming 🗓️ Thursday, 11th December 🕓 Time: 21:00 🧩 File Handling @cpp_sirius👨💻
🎓Students
The lesson will be 1 hour before at 20:00⏰
Please be aware and ready
The lesson will be 1 hour before at 20:00⏰
Please be aware and ready
❤3👌2👍1
Computer Programming
🎓Students The lesson will be 1 hour before at 20:00⏰ Please be aware and ready
🙏So sorry guys.
I will be late about 30 minutes.
Be tuned ✅
I will be late about 30 minutes.
Be tuned ✅
👍1
// problem 8
ofstream fnum("numbers.txt");
int k;
for (int i = 0; i < 100; i++) {
k = rand() % 100+1;
fnum << k << endl;
}
fnum.close();
ifstream fmax("numbers.txt");
int num, max = 0;
while (fmax>>num) {
if (max < num) {
max = num;
}
}
cout << max << endl;
fmax.close();
ofstream fnum("numbers.txt");
int k;
for (int i = 0; i < 100; i++) {
k = rand() % 100+1;
fnum << k << endl;
}
fnum.close();
ifstream fmax("numbers.txt");
int num, max = 0;
while (fmax>>num) {
if (max < num) {
max = num;
}
}
cout << max << endl;
fmax.close();