Computer Programming
262 subscribers
58 photos
15 videos
55 files
16 links
- Programming Lessons
- Daily problems
- Guide books

Murojaat: @asadbek_tolqinjonov
Download Telegram
Ovoz?
💯3👎1
Savollar?
// 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();
Live stream finished (1 hour)
Media is too big
VIEW IN TELEGRAM
🎥Lesson 10
💻C++ Programming
📁 File Handling

#cpp

@cpp_sirius👨‍💻
3🔥2
main.cpp
2.7 KB
Codes
Forwarded from Computer Programming 1
week14.pdf
107.9 KB
This week lab: File handling & structure.
It is lab work (not graded)
CS102- Computer Programming Final Preparation.pdf
209.1 KB
Here is Final Preparation notes from CS102🫠

Hope they will be really useful for you!

Don’t forget to share with friends who take this course too!🫶🏻

@studyatelier
#CS102 #finalprep
🔥4
Computer Programming
Photo
#include <iostream>
#include <vector>
using namespace std;

int main() {
int n; cin >> n;
int sum=0;
int matrix[n][100];
for (int i = 0; i < n; i++) {
sum = 0;
for (int j = 0; j < n; j++) {
cin >> matrix[i][j];
sum += matrix[i][j];
}
}
int sum2 = 0;
bool magic = true;
// row-based checking
for (int i = 0; i < n-1; i++) {
sum2 = 0;
for (int j = 0; j < n; j++) {
sum2 += matrix[i][j];
}
if (sum2 != sum) {
magic = false;
cout << "Not Magic Square" << endl;
break;
}
}
// column based-cheking
if (magic) {
for (int i = 0; i < n; i++) {
sum2 = 0;
for (int j = 0; j < n; j++) {
sum2 += matrix[j][i];
}
if (sum2 != sum) {
magic = false;
cout << "Not Magic Square" << endl;
break;
}
}
}
// diagonal based checking
if (magic) {
sum2 = 0;
int sum3 = 0;
for (int i = 0; i < n; i++) {
sum2+=matrix[i][i];
sum3+=matrix[i][n-1-i];
}
if (sum2 != sum) {
magic = false;
cout << "Not Magic Square" << endl;
}else if (sum3 != sum) {
magic = false;
cout << "Not Magic Square" << endl;
}
}
if (magic) {
cout << "Magic Square" << endl;
}
return 0;
}
5
#include <iostream>
using namespace std;

int main() {
int n; cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int temp = arr[n-1];
for (int i = n-1; i > 0; i--) {
arr[i] = arr[i-1];
}
arr[0] = temp;
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
return 0;
}
5
🎓 Students!

I hope today's exam goes smoothly and you feel confident about every question. Wishing you clear mind🧠, confidence 🙂‍↔️ and great results.

Good luck!🤞
🔥146
A exam. 20 points problem:


int** createMatrix(int rows, int cols) {
int** matrix = new int*[rows];

for (int i = 0; i < rows; i++) {
matrix[i] = new int[cols];
}

for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrix[i][j] = i + j;
}
}

return matrix;
}
2
A exam. 10-point problem


#include <iostream>
using namespace std;
int lcm(int num1, int num2) {
int a = num1;
int b = num2;
while (b>0) {
a = a%b;
int temp = b;
b = a;
a = temp;
}
return num1*num2/a;
}

int main() {
cout << lcm(48,18);
return 0;
}
4
How was the exam?

Leave comments 👇
👎8🤷‍♂33👍2🔥1
‼️Guys‼️

Can anyone send me complete and clear questions of B examʼs coding part?
5
How was your result?
1
Computer Programming
You
I guess you 🫵
👍2