Помогите написать программу на C++
/*VS C++*/ #include #include #include using namespace std; int main() { int A[5]; int B[5]; int C[5][2]; srand(time(NULL)); printf(" A B\n"); for (int i = 0; i < 5; i++) { A[i] = rand() % 50 + 1; B[i] = rand() % 50 + 1; printf("%4d", A[i]); printf("%4d\n", B[i]); } printf("\n + -\n"); for (int i = 0; i < 5; i++) { C[i][0] = A[i] + B[i]; C[i][1] = A[i] - B[i]; printf("%4d", C[i][0]); printf("%4d\n", C[i][1]); } //system("pause"); return 0; }
#include #include #include #include using namespace std; int main() { int A[5]; int B[5]; int C[5][2]; srand(time(NULL)); cout << " A B\n";<br> for (int i = 0; i < 5; i++) { A[i] = rand() % 50 + 1; B[i] = rand() % 50 + 1; cout << setw(4) << A[i] << setw(4) << B[i] << endl;<br> } cout << "\n + -\n";<br> for (int i = 0; i < 5; i++) { C[i][0] = A[i] + B[i]; C[i][1] = A[i] - B[i]; cout << setw(4) << C[i][0] << setw(4) << C[i][1] << endl;<br> } system("pause"); return 0; }
Комментарий съел include.
Добавьте еще include iomanip