Feb 2, 2019 at 2:33am UTC
Write your question here.
Hi, Im tring to write a function to accept the value that user input but i keep getting this error: error C2065: 'cin': undeclared identifier
Im really new to c++ and dont know a lot about functions
#include<iostream>
#include<string>
#include<iomanip>
double getsale(double num)
{
cin >> num;
return num;
}
//void findHighest()
using namespace std;
int main()
{
double ne, nw, se, sw;
cout << "Enter NE sales : $";
cout << getsale(ne);
cout << "Enter NW sales : $";
cout << getsale(nw);
cout << "Enter SE sales : $";
cout << getsale(se);
cout << "Enter SW sales : $";
cout << getsale(sw);
if (se > nw &&se > sw&&se > ne)
{
cout << "se is the highest\n";
}
if (sw < nw &&nw > se&&nw > ne)
{
cout << "nw is the highest\n";
}
if (ne > nw &&ne > se&&sw < ne)
{
cout << "sw is the highest\n";
}
if (sw > nw &&sw > se&&sw > ne)
{
cout << "sw is the highest\n";
}
system("pause");
return 0;
}
Feb 2, 2019 at 2:45am UTC
Your using namespace std should be included further at the top, not after the getsale function.
Feb 2, 2019 at 3:05am UTC
oooh my, how could I :))) thanks a lot