Another C++ program

Write a program that reads the data in a text file of ticket prices and number of tickets sold, calculating the number of tickets sold and total sales amount.

I have the numbers in notepad saved to use.
TammariaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Is this homework?

Please post the work that you have already done and what SPECIFIC problems you are having with it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TammariaAuthor Commented:
I had saved the problem to my Document folder and put it my compiler. I was having a problem with it running in my VS Express compiler. I got with one of my classmates and she showed me what the problem was. The compiler was saying that the library was "deprecated". I had to go to the source file and add to open it up to put in my program and ran it from there. I thought I was doing something wrong in my program but it was not. Sorry for the confusion. I can send you the copy of my program if I need to. Thank you.
0
TommySzalapskiCommented:
I imagine that at this point in the class you don't need to be linking libraries. You should probably be using a Win32 Console application and 'Empty Project' so that all it uses is your c++ code and it doesn't try to wrap its own libraries around everything.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

TammariaAuthor Commented:
I have it fixed now. When I ran my program on my computer I was having multiple error messages. Then when I took it to school, which wasn't until yesterday, I ran it on their computer and it worked without errors. It was in my compiler. It is not homework but work we did in class that the instructor put onto the board and we put into our compilers. I could not figure out why it was running with errors but it is not now. Thank you for your assistance.
0
TammariaAuthor Commented:
The linking libraries was part of the issue. I had to go into the Source File and add new to pull the compiler to get my program to run. I have my program attached. It did the output like it was supposed to but did show a negative on the second set of numbers. I do not think it was supposed to do this. Take a look at it and see what I may have wrong. The information was given to us by my professor so it should be correct but puts out a negative amount.
TotalTicketSales.cpp
Lab2Data.txt
0
TommySzalapskiCommented:
You set it up to display decimals, but then you only used ints. That seems odd.

The negative numbers are clearly wrong. It shows negative for all of them?
My guess is that the text file did not open. Make sure you check that it opened properly before you use it (your notes or book will show you the way your professor wants you to do it). Also, are you sure it's a good idea to hard code four of the same blocks of code like that? What if the text file had 20 lines instead of 4? If your grader has any sense of dignity, he will count off a lot of points. You should be using your file I/O techniques to see when you reached the end of the file or at least use a for loop.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.