so, I am writing a program for class that has me asking the user how many people want admission to a theme park, adults cost $50 and kids cost $30, and for a family of 4 or more $150. And I am supposed to output the total cost for them. It is telling me my variable totalCost is not initialized when to me it looks like it is... I made it == 0 at the start of the main function and then I add to it at the bottom but it still tells me it has no value... any help is appreciated!!
#include <iostream>;
usingnamespace std;
int main(void)
{
// next seven lines are assigning variable names and types.
int adult;
int child;
int family;
int totalCost;
int totalCostChild;
int totalCostAdult;
totalCost == 0;
adult == 50;
child == 30;
family == 150; // next four ask for user input.
cout << "How many adults?\n";
cin >> adult;
cout << "How many children?\n";
cin >> child;
if (child>=4); // the rest of the code calculates how much it will cost this person, and outputs the total cost.
cout << "cost is $150";
if (child<=4);
(totalCostChild << child*30);
if (adult>=4);
cout << "cost is $150";
if (adult<=4);
(totalCostAdult << adult*50);
totalCost + (totalCostAdult + totalCostChild); // Total cost IS INITIALIZED do not know what I am doing wrong here.
cout << "your price is:" << totalCost;
return 0;