Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

cout error message

+2 votes
asked Sep 25, 2021 by Peyton Sheffield (140 points)

#include
using namespace std;
int
main ()
{
  // Number of customers
  int numCustom = 16500;
  // Percent of customers that buy energy drink per week
  double energyDrinkPurch = 0.15;
  // Percent of energy drinks that are purchase that are flavored citrus
  double citrusEnergy = 0.58;
  // Percent of cutomers that bought something other than an energy drinks
  double otherPurch = 0.85;
  // Number of cutomers who bought energy drinks
  double customEnergyDrink = numCustom * energyDrinkPurch;
  // Number of cutomers that prefer citrus flavored energy drink
  double citrusPref = customEnergyDrink * citrusEnergy;
  // Number of cutomers who but something besides of the energy drink
  double otherCustomPurch = numCustom * otherPurch;
  // Output of the totals
  
    cout << "The approximate number of cutomers that purchase at least one energy drink per week is" << customEnergyDrink;
    
    cout << "\nThe approximate number of customers that purchase energy drinks and that prefer the citrus flavoris" << citrusPref;
  
    cout << "\nThe approximate number of cutomers that purchase something besides an energy drink is" << otherCustomPurch endl;
  return 0;
}

but then i keep getting an error message 

 #include
         ^
main.cpp: In function ‘int main()’:
main.cpp:30:5: error: ‘cout’ was not declared in this scope
     cout << "The approximate number of cutomers that purchase at least one energy drink per week is" << customEnergyDrink;
     ^~~~

1 Answer

0 votes
answered Sep 25, 2021 by LOLITA CALVA CARREÑO (140 points)

You are missing what goes after the "include"

     #include <iostream>

You are also missing the "<<" in the "endl"

     cout << "\nThe approximate number of cutomers that purchase something besides an energy drink is" << otherCustomPurc << endl;

When you have an error I recommend that you check to the previous lines. Usually those have an error.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...