![]() |
|
#1
|
|||
|
|||
Help approaching a programHello everybody, I need help on how to start this program, I need to ask the user for this information and write it to a file: Student number, Student Name, ClassID, Credits and grade. The user is should be allowed to enter as many studentsas he likes (until '*' is entered) and he can also enter more than one class for each student. So, I was thinking a way to do this.. making a dimensional array, and store the each student in the rows, and the rest info on the colums... would that make any sense? is that posible? I need then to re-dispay the info that was entered. Any feedback on how should i start this program?
Any help would be much appreciated! thanks! |
|
#2
|
|||
|
|||
Re: Help approaching a programQuote:
Quote:
The simplest solution is get one record from the user & immediately write it to the file. Repeat until the sentinel value has been read. |
|
#3
|
|||
|
|||
Re: Help approaching a programQuote:
All seem to be logically related data items. Just as ocicat poined it out Quote:
Instead of storing them in an array,Suppose you create a strucure called student CPP / C++ / C Code:
Instead of creating an multidimensional array,an array of structures will make it much more simpler as ... Quote:
http://www.cplusplus.com/doc/tutorial/structures.html This should give you a start,though the program doesn't respond to the star condition CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
Re: Help approaching a programOk thanks I already started the program.. but i got stuck in another part...
I have to validate the studentNumber to be only 9 either alpha/digits inputs. I was thinking of doing something like this but it is not working... is there any other way? or am I doing something wrong? CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Re: Help approaching a programoh and just in case.. studentNumber is a string .. can i use this types of validations in a string? or should I use another type of validation?
|
|
#7
|
|||
|
|||
Re: Help approaching a programwill isalnum work for a string Class?
|
|
#8
|
|||
|
|||
Re: Help approaching a programQuote:
http://www.cplusplus.com/reference/string/string/ ...I don't see that this topic is expanded for strings in the aggregate, however, you can use isalnum() on each individual character within the string. See the c_str() member function for how to access the underlying C-style string implementation. |
|
#9
|
|||
|
|||
Re: Help approaching a programOk, I could not do it using strings. So now I am trying with chars, maybe thats easier, I got working the validation for the studentNumber to check if the it is alpha's or digits, but i also need to validate that what the user is entering is only 9 digits/alpha longs. I tried several ways, but I can't figure it out....
CPP / C++ / C Code:
Any tips?? |
|
#10
|
|||
|
|||
Re: Help approaching a programQuote:
Quote:
By the way, entering twelve characters consumes thirteen characters in a buffer. Quote:
As for the code posted:
|
Recent GIDBlog
US Elections and the ?Voter?s Responsibility? by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Greatest and smallest integers | bostero22 | C++ Forum | 8 | 01-Nov-2008 00:13 |
| Equation solver | RazoR | C Programming Language | 3 | 18-May-2008 10:24 |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 11:13 |
| Help with a complex program | lordfuoco | C++ Forum | 5 | 24-Jun-2006 07:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The