Amaliy mustaqil ish
Download 272.99 Kb. Pdf ko'rish
|
AMALIY
AMALIY MUSTAQIL ISH Sizga o'lchami n*m lik bo'lgan matrica berilgan. Bu k-qator elementlari olib tashlansin. #include using namespace std; int main() { int m, n; cout << "Matricaning ustunlar sonini kiriting\n>>> n = "; cin >> n; cout << "Matricaning satrlar sonini kiriting\n>>> m = "; cin >> m; int matrix[m][n]; cout << endl; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cout << "Matricaning " << i + 1 << "-qatoridagi " << j + 1 << "- elementni kiriting: "; cin >> matrix[i][j]; } cout << endl; } cout << "Hosil bo'lgan matrica:\n"; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cout << matrix[i][j] << " "; } cout << endl; } int k; cout << endl << "Matricaning nechinchi qatorini o'chirishni istaysiz?\nk = "; cin >> k; cout << endl; for (int j = k; j < m; j++) { for (int i = 0; i < n; i++) { matrix[j - 1][i] = matrix[j][i]; } } cout << "O'zgartirilgan matrica:\n"; for (int i = 0; i < m - 1; i++) { for (int j = 0; j < n; j++) { cout << matrix[i][j] << " "; } cout << "\n"; } } Natija: Download 272.99 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling