Przy debugowaniu w Visual Studio kompilator pokazuje, że jest błąd
#include <iostream>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main() {
// Declaring and initializing variables
int a_min = 1, a_max = 5;
int b_min = -7, b_max = 7;
int c_min = -10, c_max = 10;
int x, a, b, c;
//Arrays for a, b and c
int array_a[2];
int array_b[2];
int array_c[2];
srand(time(NULL));
// GENERATING RANDOM NUMBERS FOR a, b and c
for (int i = 0; i < 3; i++) {
a = a_min + rand() % a_max;
b = b_min + rand() % (b_max - b_min + 1);
c = c_min + rand() % (c_max - c_min + 1);
// Saving values in arrays
array_a[i] = a;
array_b[i] = b;
array_c[i] = c;
}
//Printing saved values in arrays
//Just to know what we have and to compare the results.
cout << "\n \n DATA IN THE ARRAYS \n \n";
for (int i = 0; i < 3; i++) {
cout << "a" << i << " ";
cout << array_a[i] << " ";
}
cout << endl;
for (int i = 0; i < 3; i++) {
cout << "b" << i << " ";
cout << array_b[i] << " ";
}
cout << endl;
for (int i = 0; i < 3; i++) {
cout << "c" << i << " ";
cout << array_c[i] << " ";
}
cout << endl;
cout << "---------------------- \n" << endl;
//Multiplying the values of the arrays by each argument
for (int x = -10; x <= 10; x++) { //itarating the range -10 to 10
for (int i = 0; i < 3; i++) {
cout << x * array_a[i] << " ";
}
cout << endl;
for (int i = 0; i < 3; i++) {
cout << x * array_b[i] << " ";
}
cout << endl;
for (int i = 0; i < 3; i++) {
cout << x * array_c[i] << " ";
}
cout << endl << endl;
cout << endl << endl;
}
return 0;
}
```c++
oraz```
. Możesz też zaznaczyć kod i użyć przycisku</>
na pasku narzędzi.