Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:02:27+00:00 2026-05-29T08:02:27+00:00

Ok so for an assignment we have to make our first program. Mine is

  • 0

Ok so for an assignment we have to make our first program. Mine is to make a program that calculates the ticket revenue for each seating section at a theater. The problem is that I keep getting this undeclared identifier or identifier undefined error along with like 23 other errors. The program I am using is Visual Studio 2010 Premium.

Here is my code.

// Chp4HWprgm.cpp 
// Created by Bryce Easley on 2/6/2012
#include <iostream>
using namespace std;

int main(){
//declare variables

int orchestraNum = 0;
int mainNum = 0;
int balconyNum =0;
const orchestraPrice = 25;
const mainPrice = 30;
const balconyPrice = 15;

//enter input of sales
cout << "Number of Orchestra tickets sold?";
cin >> orchestraNum;
cout << "Number of Main Floor tickets sold?";
cin >> mainNum;
cout << "Number of Balcony tickets sold?";
cin >> balconyNum;

//calculate revenue for each and total revenue
orchestraTotal = orchestraNum * orchestraPrice;
mainTotal = mainNum * mainPrice;
balconyTotal = balconyNum * balconyPrice;
overallTotal = mainTotal + balconyTotal + orchestraTotal;

//display figures
cout <<"Orchestra Revenue: $" << orchestraTotal << endl;
cout <<"Main Floor Revenue: $" << mainTotal << endl;
cout <<"Balcony Revenue: $" << balconyTotal << endl;
cout <<"Overall Revenue: $" << overallTotal << endl;

system("pause");
return 0;}
//end of main function 

Here are my errors:

Error 6 error C2065: ‘balconyTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 28 1 Chapter4HW
Error 9 error C2065: ‘balconyTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 29 1 Chapter4HW
Error 13 error C2065: ‘balconyTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 34 1 Chapter4HW
Error 5 error C2065: ‘mainTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 27 1 Chapter4HW
Error 8 error C2065: ‘mainTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 29 1 Chapter4HW
Error 12 error C2065: ‘mainTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 33 1 Chapter4HW
Error 4 error C2065: ‘orchestraTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 26 1 Chapter4HW
Error 10 error C2065: ‘orchestraTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 29 1 Chapter4HW
Error 11 error C2065: ‘orchestraTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 32 1 Chapter4HW
Error 7 error C2065: ‘overallTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 29 1 Chapter4HW
Error 14 error C2065: ‘overallTotal’ : undeclared
identifier c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 35 1 Chapter4HW
Error 1 error C4430: missing type specifier – int assumed. Note: C++
does not support
default-int c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 13 1 Chapter4HW
Error 2 error C4430: missing type specifier – int assumed. Note: C++
does not support
default-int c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 14 1 Chapter4HW
Error 3 error C4430: missing type specifier – int assumed. Note: C++
does not support
default-int c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 15 1 Chapter4HW
15 IntelliSense: explicit type is missing (‘int’
assumed) c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 13 7 Chapter4HW
16 IntelliSense: explicit type is missing (‘int’
assumed) c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 14 7 Chapter4HW
17 IntelliSense: explicit type is missing (‘int’
assumed) c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 15 7 Chapter4HW
20 IntelliSense: identifier “balconyTotal” is
undefined c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 28 1 Chapter4HW
19 IntelliSense: identifier “mainTotal” is
undefined c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 27 1 Chapter4HW
18 IntelliSense: identifier “orchestraTotal” is
undefined c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 26 1 Chapter4HW
21 IntelliSense: identifier “overallTotal” is
undefined c:\users\bryce\desktop\cpp6\chap04\chapter4hw\chapter4hw\chp4hw.cpp 29 1 Chapter4HW

Gracias to everyone that answered. I seriously stared at this forever and I couldnt figure it out. It’s like learning a whole new language and it’s a bit confusing!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:02:28+00:00Added an answer on May 29, 2026 at 8:02 am

    You need to declare your constants and total variables with types:

    const int orchestraPrice = 25; 
    const int mainPrice = 30; 
    const int balconyPrice = 15;
    
    ...
    
    //calculate revenue for each and total revenue 
    int orchestraTotal = orchestraNum * orchestraPrice; 
    int mainTotal = mainNum * mainPrice; 
    int balconyTotal = balconyNum * balconyPrice; 
    int overallTotal = mainTotal + balconyTotal + orchestraTotal;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For an assignment in college, we have to make a script in Perl that
For an assignment at school, we have to use structs to make matrices that
For our assignment we have to code a program in C, but it says
For my assignment I have to put make a card memory game that allows
For a school assignment we have to make a client server chat program in
For my university assignment I have to make a networkable version of pacman. I
For a school assignment, we have to make a Usecase diagram. But the documentation
For a homework assignment I have to make a makefile (physically and in software)
So i have an assignment in which i have to make a guessing game
I have an assignment, and it has (amongst others) two demands: make an installer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.