У меня простая программа, и она работает нормально, но в операторах system("CLS");
и system("pause");
есть красные линии IntelliSense под ними. Когда я перемещаю курсор над ними, он говорит Error "system" is ambiguous.
Что вызывает это?
Вот мой код:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int choice = 0;
const double PI = 3.14159;
double sideSquare = 0.0;
double radius = 0.0;
double base = 0.0;
double height = 0.0;
cout << "This program calculates areas of 3 different objects." << endl;
cout << "1.) Square" << endl;
cout << "2.) Circle" << endl;
cout << "3.) Right Triangle" << endl;
cout << "4.) Terminate Program" << endl << endl;
cout << "Please [Enter] your object of choice: ";
cin >> choice;
system("CLS"); // The problem is here...
switch(choice)
{
case 1:
cout << "Please [Enter] the length of the side of the square: ";
cin >> sideSquare;
cout << "The area is: " << pow(sideSquare, 2) << endl;
break;
case 2:
cout << "Please [Enter] the radius of the circle: ";
cin >> radius;
cout << "The area is: " << PI * pow(radius, 2) << endl;
break;
case 3:
cout << "Please [Enter] the base of the triangle: ";
cin >> base;
cout << endl << "Now [Enter] the height of the triangle: ";
cin >> height;
cout << "The area is: " << (base * height) / 2 << endl;
break;
default:
cout << "Please [Enter] a valid selection next time." << endl;
return 0;
}
system("pause"); // ... and here.
return 0;
}