![]() |
|
#1
|
|||
|
|||
Problems with switch statementThis program displays the information of an input file containing dates and strings, the output is in the following form On day, January 1, 1800 The first day begins. [number of days since 1/1/1800; (1)]. My problem is implementing a correct switch statement to display the Day of the week. The day ot the week is found using the number of days since 1.1.1800, here's the code and an attached file. Also I' not sure if the correct output in the number of days is right. If someone could check my code, I would appreciate it.
CPP / C++ / C Code:
|
|
#2
|
||||
|
||||
|
Quote:
To check if your computations are correct, search the web for a perpetual calendar and use that to test your program. There are lots of them around. __________________
Age is unimportant -- except in cheese |
|
#3
|
|||
|
|||
|
Quote:
Thanks for the help, it fixed one my errors. However, the program still loops to one Day. I don't understand why. |
|
#4
|
|||
|
|||
|
Quote:
Look at this: CPP / C++ / C Code:
You need to switch on the number of days since Jan 1, 1800. (But you made the daysSince element private.) There are several computational errors that you should be able do discover as you run the program. For starters: just use Jan 1, 1800. Concentrate on that. You must get the right answer here, otherwise, nothing can possibly work? When you can get the right answer for that, then try Feb 2, 1800, Mar 3, 1800, etc. Finally, try other years. Sprinkle cout<< throughout your routines to see where the calculations are taking you. Regards, Dave |
|
#5
|
|||
|
|||
|
Quote:
Thanks for the help. I made some changes, first I made the prototypes bool, and Prettyprint public members. Then I made them friend functions, to allow them access to the private member. Thus fixing my switch statement problem. |
Recent GIDBlog
Flickr uploads of IA pictures by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Command Line Arguments, Part 1 | WaltP | C Programming Language | 0 | 10-Jul-2004 23:34 |
| Chaintech Geforce 5600 FX problems | bartster74 | Computer Hardware Forum | 8 | 04-May-2004 13:16 |
| Help a C++ Idiot: I am trying to fill an array based on a switch statement. | Psycop | C Programming Language | 2 | 14-Apr-2004 03:12 |
| switch statement | freedomJoe | C Programming Language | 0 | 27-Oct-2003 08:45 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The