![]() |
|
#1
|
|||
|
|||
first posthey whats going on, just had a quick question, iam teaching myself c++ and am in kind of a rut, iam makeing a program that compares zipcodes and tells you the shipping for them, the problem is that its only printing the first value ($25), the program checks the first 3 digits (of 5) to see if its a correct value (either 605 or 606). everything compiles but it seems to just do the 605 part
CPP / C++ / C Code:
|
|
#2
|
|||
|
|||
Re: first postQuote:
1. The string::compare function returns an int value of zero if the comparands are equal. 2. Logic flow is made somewhat obscure (to me, at least) by inconsistent indentation. 3. If you are going to use returns after the comparisons, then the "else" isn't really necessary. On the other hand, some people prefer not to have "returns" in the middle of a function. (Maybe not very important for a short program, but gets hard to follow for bigger efforts.) Consider something like the following: CPP / C++ / C Code:
Regards, Dave |
|
#3
|
|||
|
|||
Re: first postIndentation is very important in programming when others read your program or u doing maintenance about ur program.
This is a good practice. __________________
Linux is the best OS in the world. |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free Hosting From FridayHosting | crazyboy168 | Free Web Hosting | 0 | 30-Nov-2007 12:02 |
| The questions you should ask yourself before you make a post on your blog | Vahid | Open Discussion Forum | 0 | 10-Mar-2007 10:24 |
| HTTP post program generates 302 moved error | HarmoniousBotch | C Programming Language | 4 | 14-Jan-2007 16:13 |
| Promoting my forum Get paid upto $0.05 Per post | Talktechno | Member Announcements, Advertisements & Offers | 0 | 10-Oct-2006 01:37 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The