Next Question
RSS
The problem is that you forget to close the outermost switch statement for each of your nested switch statements:
Permalink | Report
srgothard
If you really want to keep going down this path then here is some info on automatic braces matching in the VC++ tools. Good luck.
In languages other than Visual Basic, by placing the cursor to the left of a brace and pressing CTRL+], the cursor will move to the matching brace. http://msdn.microsoft.com/en-us/library/be94e8aw(VS.80).aspx
Automatic highlighting of matching braces for Visual Studio C++
http://www.codeproject.com/KB/macros/matchingbraces.aspx
Source(s):
20+ years of programming experience.
Permalink | Report
Answered Question
M$1
May 11, 2009 03:06 AM
Error C1004: Unexpected end of file; C++ issues.
Well, at orange's advice, I pasted the code itself here: http://pastebin.com/m12163fff
As my first program, with limited experience, there are probably dozens of things I could do better, and while pointers are greatly welcome, my particular question is WHERE IN THE WORLD AM I MISSING A BRACE!!! I've done some serious searching myself, but everything looks fine to me. I even tried adding 'punctuation' places to see if it helped, but as of right now, I'm stumped and frustrated. If anyone feels like helping me peruse the almost 6000 lines of code, I'd be extremely grateful.
As my first program, with limited experience, there are probably dozens of things I could do better, and while pointers are greatly welcome, my particular question is WHERE IN THE WORLD AM I MISSING A BRACE!!! I've done some serious searching myself, but everything looks fine to me. I even tried adding 'punctuation' places to see if it helped, but as of right now, I'm stumped and frustrated. If anyone feels like helping me peruse the almost 6000 lines of code, I'd be extremely grateful.
Interesting Question?
Yes (0)
No (0)
- In Programming |
- |
- Report |
-
Share
RSS
Best Answer Chosen by Asker
| May 12, 2009 01:36 PM |
- You have a nested switch statement for days that is nested at most 4 deep for
randday1, randday2, randday3, and randday4. Before you begin movie genre, you didn't close the outermost switch for days. There should be a closing brace right after the "break" before the switch statement for randmovie1. - Similarly, you don't close the outermost switch for movie genre. There should be a closing brace right after the "break" before the switch statement for randsnack1.
- Again the problem is repeated for the outermost switch statement for snack. There should be a closing brace right after the "break" before the switch statement for randperson1.
- Finally, the outermost switch statement for person is not closed. There should be a closing brace right after the "break" before the switch statement for randclue1.
| Asker's Rating: |
• I closed them up, and FINALLY I got the program to run. Unfortunately, for whatever reason, it's not doing what it is meant to do. Can I not write out the clues like I did? I thought you could do the "%d" thing, then call the replacement after the comma. I'm just going to put this project on hold until I know what I'm doing. Since you got it to go, you had the best answer, thank you!
Permalink | Report
srgothard
May 12, 2009 08:30 PM
You need to use %s for strings. %d is for integers. You probably need to use the sprintf function to do what you are doing.
Tip srgothard for this comment
Report
Other Answers (2)
May 11, 2009 04:24 AM
I'm VERY new to the world of programming, so whatever compiler I'm using is whatever comes on the Visual Studio 6 disk.
I tried playing around with that chunk, and nothing happened, which worries me, because you'd think if I added an extra ';' somewhere I'd at least get new errors. Thanks a lot for giving it a go, though; I didn't really think anyone would want to read through all of that mess. I already had to go through it once, correcting 100+ similar errors regarding the whole "switch" thing.
Report
I tried playing around with that chunk, and nothing happened, which worries me, because you'd think if I added an extra ';' somewhere I'd at least get new errors. Thanks a lot for giving it a go, though; I didn't really think anyone would want to read through all of that mess. I already had to go through it once, correcting 100+ similar errors regarding the whole "switch" thing.
May 11, 2009 01:21 PM
Yow.. did you inherit this code and are now having to maintain it or something? If you have a choice I'd suggest using both a newer version of Visual Studio, and a language like VB or C# which is in some ways a lot less confusing and easier to use than C++ for some tasks.
In the meantime you might try posting this on a Google Group or other newsgroup where C++ developers are lurking. You might also find some good leads at http://www.experts-exchange.com.
Good luck!!
Report
In the meantime you might try posting this on a Google Group or other newsgroup where C++ developers are lurking. You might also find some good leads at http://www.experts-exchange.com.
Good luck!!
May 12, 2009 07:01 AM
This is what my uncle told me to use, and he's making 6 figures while I struggle at Mickey D's, so at first I trusted him, but now I realize that he's a little nuts. I had to BUY the VC++6 book, because the one he gave me was for visual studio 1.5! I think they still used punch cards back then, haha! So yeah, that might be the way to go, eventually, but for right now, he wants me to learn C++ AND VB, AND SQL (which I've never even been exposed to) and I think Perl is next, whatever that is. I think he thinks I'm a machine or something. But he's offering $40/hr to work part time out of my house, so he's the bo$$ :)
As far as programming groups, I've been looking at DaniWeb, but they seem a little high-and-mighty for me. They're too paranoid that someone is just gonna copy their answers for homework.
Report
As far as programming groups, I've been looking at DaniWeb, but they seem a little high-and-mighty for me. They're too paranoid that someone is just gonna copy their answers for homework.
May 11, 2009 06:31 PM
Ok, I looked at your code and the Error C1004: Unexpected end of file error is the least of your worries. This code really needs to be rewritten from scratch as you control structures are too large to be easily debugged. You have made one of the classic mistakes new programmers make, copying and pasting too many times. If you are going to do the same thing more than two times you should be creating a subroutine. When you use a subroutine you only have to debug and fix the code once not 100+ times. If this code is for a programming assignment don't hand it in! Even i it works you will undoubtedly fail the assignment. Spend a bit of time with paper and pencil to design your code before you write it. If you really want to keep going down this path then here is some info on automatic braces matching in the VC++ tools. Good luck.
In languages other than Visual Basic, by placing the cursor to the left of a brace and pressing CTRL+], the cursor will move to the matching brace. http://msdn.microsoft.com/en-us/library/be94e8aw(VS.80).aspx
Automatic highlighting of matching braces for Visual Studio C++
http://www.codeproject.com/KB/macros/matchingbraces.aspx
Source(s):
20+ years of programming experience.
Permalink | Report
May 12, 2009 06:51 AM
My uncle is trying to get me into programming so that I can help him out with his new business. He and my other uncle have been working together for a few years now making code "on demand" for various clients, and their work load is starting to get heavy. Since they both feel I'm a fast learner, they decided to give me a bunch of old VB, C++, and SQL books to get me started. They literally just threw me in a few weeks ago, and I suppose I'm sinking, but, luckily, no, this is not a homework assignment. I was just trying to make sure I got the idea of setting up a program, without reading it line for line out of a book.
First off, SAMS Teach Yourself Visual C++ 6 in 21 Days makes no mention of subroutines, so I haven't the slightest idea how to set one up. Books are stupid, and so am I. And good god, in all those lines of code, all I wanted to do was to randomly shuffle the the strings, so that each time I click the "New Puzzle" button, I get new clues to pop up on the dialog. Is there no "shuffle" function built in? I just can't think of a cleaner way to do this without running the risk of recurring strings. I can't have two Joe's! And believe me, I've learned my lesson with the cut/paste 'technique'. I spent 90 minutes adding braces and "break;" in SO MANY PLACES.
Thank you for your answer, but it's almost 2 am, and I have to wait and see if I can get this running in the morning. If you like to tell me a little about subroutines, I'd gladly throw in my last $1M as a tip. (I'm definitely going to have to invest in some serious mahalo dollars when I start college in the fall.)
Report
First off, SAMS Teach Yourself Visual C++ 6 in 21 Days makes no mention of subroutines, so I haven't the slightest idea how to set one up. Books are stupid, and so am I. And good god, in all those lines of code, all I wanted to do was to randomly shuffle the the strings, so that each time I click the "New Puzzle" button, I get new clues to pop up on the dialog. Is there no "shuffle" function built in? I just can't think of a cleaner way to do this without running the risk of recurring strings. I can't have two Joe's! And believe me, I've learned my lesson with the cut/paste 'technique'. I spent 90 minutes adding braces and "break;" in SO MANY PLACES.
Thank you for your answer, but it's almost 2 am, and I have to wait and see if I can get this running in the morning. If you like to tell me a little about subroutines, I'd gladly throw in my last $1M as a tip. (I'm definitely going to have to invest in some serious mahalo dollars when I start college in the fall.)
Answer this Question
Related Questions
No questions found.
Ask a Question
Buy Mahalo Dollars with Credit Card or PayPal
Top Members
Most Popular Tags
Categories
- Anonymous
- Arts & Design
- Beauty & Style
- Books & Authors
- Business
- Cars & Transportation
- Consumer Electronics
- Coupons Deals
- Education
- Entertainment
- Environment
- Fitness
- Food & Drink
- From Email
- From Iphone
- From Twitter
- Health
- History
- Hobbies
- Home & Garden
- How Tos
- Humor
- Jobs
- Legal
- Local
- Love & Relationships
- Mahalo Answers Community
- Money
- Music
- News
- NSFW
- Parenting
- Pets
- Science & Mathematics
- Services
- Shopping
- Social Science
- Society & Culture
- Sports
- Technology & Internet
- Travel
- Video Games
Welcome New Members
- americavalentin, December 05, 2009 11:13 PM
- thirty6, December 05, 2009 11:13 PM
- conundrum_krist..., December 05, 2009 11:12 PM
- dazenews, December 05, 2009 11:11 PM
- emerson, December 05, 2009 11:11 PM
Mahalo Dollars are the currency of Mahalo Answers.
Each Mahalo Dollar costs $1.
Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More