// Energy drink assignment from page 77 #18
#include <iostream>
using namespace std;
int main ()
[{
int numberSurveyed = 12,467;
int energyDrinkers;
int citrusFlavor;

energyDrinkers =static_cast<int>(numberSurveyed)* 0.14;
citrusFlavor =static_cast<int>(energyDrinkers)* 0.64;

// Approimate calculations from survey print out
// 14% of 12,467
cout << "Approximate number of customers who purchase one or more energy drinks per week" << energyDrinkers << endl;
//64% of the outcome of energy drinkers
cout << "Approximate number of customers who perfered citrus" << citrusFlavor << endl;

return 0;
}]

2
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by ScalesTech

can someone please assist me with this issue?

// Energy drink assignment from page 77 #18
#include <iostream>
using namespace std;
int main ()
[{
int numberSurveyed = 12,467;
int energyDrinkers;
int citrusFlavor;

energyDrinkers =static_cast<int>(numberSurveyed)* 0.14;
citrusFlavor =static_cast<int>(energyDrinkers)* 0.64;

// Approimate calculations from survey print out
// 14% of 12,467
cout << "Approximate number of customers who purchase one or more energy drinks per week" << energyDrinkers << endl;
//64% of the outcome of energy drinkers
cout << "Approximate number of customers who perfered citrus" << citrusFlavor << endl;

return 0;
}]

Can't help much for 2 reasons:
1. Is there supposed to be a question in there somewhere?

2. [code] ...code tags... [/code] are your friend.

``````#include <iostream>
int main() {
std::cout << "This looks nice, and is easily readable." << std::endl;
return 0;
}``````

#include <iostream>
int main() {
std::cout << "This looks like dung, and isn't readable." << std::endl;
return 0;
}

I have a question for you. Why does your main() start with '[{' and end with '}]'? That's clearly not right...

Edited by Fbody: n/a

[

Edited by ScalesTech: n/a

I guess I need to learn how to thread properly as well

You're new, so no worries. As long as you're aware. Now, what exactly is the issue? I'm afraid we can't help much because you haven't exactly given us any information to go on.

What is the program supposed to do? Where are you having an issue? This is obviously some sort of compilation error, so the complete error message and your IDE/compiler information will be helpful. Is there any other information that you think may be beneficial to us? What have you tried on your own to correct the issue?

Edited by Fbody: n/a

ok, I think I may have found the issue...

// Energy drink assignment from page 77 #18
#include <iostream>
using namespace std;
int main ()
{
int numberSurveyed = 12467;
int energyDrinkers;
int citrusFlavor;

energyDrinkers =static_cast<int>(numberSurveyed)* 0.14;
citrusFlavor =static_cast<int>(energyDrinkers)* 0.64;

// Approimate calculations from survey print out

// 14% of 12,467
cout << "Approximate number of customers who purchase one or more energy drinks per week" << energyDrinkers << endl;

//64% of the outcome of energy drinkers
cout << "Approximate number of customers who perfered citrus" << citrusFlavor << endl;
return 0;
}

The program is suppose to show the approximate number of customers in the survey who purchase energy drinks. Then it should show the number of customers who perfer citrus

My apologies for the bad threading... I will learn shortly and post better next time.Thanks for any help and time put forward to answering my questions.

One more thing, when it prints it quickly disappears. Any suggestions?

Right before your return 0, add the line cin.get(). That will make the program wait for you to press a key. Then, when you press a key, it will close.

Thank you Fbody!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.