Build Errors on the following code
I get build errors when trying to compile the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
//Define a struct called AdvertisingIncome
struct AdvertisingIncome
{
int nAdsShown;
float fUsersClicked;
float fEarnings;
};
void PrintAdvertisingIncome(AdvertisingIncome ad)
{
using namespace std;
cout << "Amount of Ads Shown: " << ad.nAdsShown << endl;
cout << "% of users clicked on ads: " << ad.fUsersClicked << endl;
cout << "Avg earnings on ads clicked: "<< ad.fEarnings <<endl;
cout << "Total Earnings $ " <<
(ad.nAdsShown * ad.fUsersClicked * ad.fEarnings) << endl;
};
int main()
{
using namespace std;
AdvertisingIncome ad;
cout << "how many adverts were shown today: " << endl;
cin >> ad.nAdsShown >> endl;
cout << "percentage of users clicking on ads: " << endl;
cin >> ad.fUsersClicked >> endl;
cout << "earnings from adverts being clicked: $" << endl;
cin >> ad.fEarnings >> endl;
PrintAdvertisingIncome(ad);
system("pause");
return 0;
}
|
I'm not sure where I am going wrong here?
Using std::endl with std::cin doesn't seem like a good idea. :)
ah yes not a good idea not sure why I put those there!
Thanks.
Topic archived. No new replies allowed.