Home c++ cin, cout, system are not unambiguous, how to remove errors?

cin, cout, system are not unambiguous, how to remove errors?

Author

Date

Category

The program is completely satisfied with the calculations, it multiplies 2 matrices of the specified size with random numbers, it starts and calculates correctly, but it shows that there are errors like: cin, cout, system are not unambiguous, only 17 errors, these operators underline in red how to remove it?

#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int** P1, ** P2, ** P3, n, m;
cout << "Enter count-in the rows of the matrix: ";
cin >> n;
cout << "Enter count-in the columns of the matrix: ";
cin >> m;
P1 = new int* [n];
for (int i = 0; i < n; i++)
    P1[i] = new int[m];
srand(time(0));
for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)  //random1 matrices
        P1[i][j] = rand() % 10;
for (int i = 0; i < n; i++)
{
    cout << endl;                  //output1 matrices
    for (int j = 0; j < m; j++)
    {
        cout << setw(3) << P1[i][j] << "\t";
    }
}
cout << endl;
int k;
cout << "Enter count-in columns2 matrices: ";
cin >> k;
P2 = new int* [k];
for (int i = 0; i < m; i++)
    P2[i] = new int[k];
for (int i = 0; i < m; i++)
    for (int j = 0; j < k; j++)  //random2 matrices
        P2[i][j] = rand() % 10;
for (int i = 0; i < m; i++)
{
    cout << endl;                  //output2 matrices
    for (int j = 0; j < k; j++)
    {
        cout << setw(3) << P2[i][j] << "\t";
    }
}
cout << endl;
P3 = new int* [n];
for (int i = 0; i < n; i++)
    P3[i] = new int[k];
for (int i = 0; i < n; i++)
{
    for (int j = 0; j < k; j++)  //matrix multiplication
    {
        P3[i][j] = 0;
        for (int z = 0; z < m; z++)
            P3[i][j] = P3[i][j] + P1[i][z] * P2[z][j];
    }
}
cout << endl << "The result of the multiplication:" << endl;
for (int i = 0; i < n; i++)                     //output 
 multiplication
{
    cout << endl;
    for (int j = 0; j < k; j++)
        cout << setw(3) << P3[i][j] << "\t";
}
cout << endl;
for (int i = 0; i < n; i++)
    delete[] P1[i];
delete[] P1;
for (int i = 0; i < m; i++)
    delete[] P2[i];
delete[] P2;
for (int i = 0; i < n; i++)
    delete[] P3 [i];
delete[] P3;
system("pause");
return 0;
}

Answer 1, authority 100%

I myself constantly face this problem in VS. In practice it helps to erase and re-print the namespaced string (In your case: std). But I do not know the reasons for this problem. I assume this is an IntelliSense issue.


Answer 2

I don’t know why, but the errors disappeared by themselves, I just started the next day, fixed only deleting arrays, but here is a version of the program with correct deletion, everything went by itself, miracles


Answer 3

This is a project error, you just need to copy the code into a new project, but first you need to connect the libraries, and then paste the code

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions