Hey guys, I am a new programmer just starting. The assignment my prof gave us has to deal with taking a file (the file is an equation, 5+2-3*2 for example) and calculating the result. The program also has to give appropriate errors when they arise. (missing operators, etc). I am a bit confused on how to do this, any help would be great thanks!
Gotovina7
0
Light Poster
Recommended Answers
Jump to PostOK, sorry for the double post.
The reason it hasn't complained about "c" is that it is a global variable, which I am trying to get you to avoid using. The same is true of "file1". In all your procedures and functions, you could get rid of the "var …
Jump to PostRather than a bunch of "if foo = x ... " statements, use a "case foo of" statement:
case oper of '+': begin ... end; '-': begin ... end; end;
You've already got a function that will read a number. (You used it to get num1.) Use …
Jump to PostWell, you know that the loop is reading the numbers correctly (because you before tested it by just reading and printing the numbers, and they printed the correct numbers).
But now that you are doing something to the numbers something is wrong.
May I suggest that num1 and …
Jump to PostIt is hard for a beginner, but not quite "way too hard".
Let me think a bit and post back later. My brain hurts and I'm tired of going around in circles with you.
Some quick things first:
1. Your last thoughts seem like a good plan.
2. …
Jump to PostThat, plus you may want to have a little patience. Fora like this aren't IM or Twitter; they are more like email, where you might have to wait hours or even days before a response. OTOH, it also means that you aren't limited to 140 characters, so posts can be …
All 69 Replies
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Gotovina7
0
Light Poster
Duoas
1,025
Postaholic
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.