Okay, i have a small problem with my code.
First ill give a rundown on what is supposed to be happening.
The program accepts an input of name as a character string, and a date (YYYY MM DD).
The date is copied into 3 variables year, month, day.
This is input in a function iohandling, and sent back to main.
Next, the function make_date takes this data and inputs it all into a DATE structure.
The next function date2str accepts this structure and converts the month value into a string referring to the # in month.
It also takes the struct and inputs ALL the data into a single string in the form:
NAME - "MONTH STRING", DD. YYYY.
This program will accept names and corresponding dates until an invalid date is entered or nothing is entered for name or date.
I have watched all the variables, and stepped throuugh the program and have found that the program works right, for a single input.
Then to get the data printed you have to enter null data, or invalid data.
The program will overwrite the structure of good data the array WAS pointing to with the null data....as well as fill the new structure the array is NOW pointing to with the null data.
If this is confusing....ill post the code here as well as an example output
if i enter 5 dates, say
Ryan
2000 05 05
Bill
2000 06 06
Jim
2000 07 07
Tom
2000 08 08
Joe
2000 09 09
Then nothing (NULL)
and nothing
I get printed
- May, 5. 2000
- June, 6. 2000
- July, 7. 2000
- August, 8. 2000
- September, 9. 2000
OR alternately
Ryan
2000 05 05
Bill
2000 06 06
Jim
2000 07 07
Tom
2000 08 08
Joe
2000 13 09 (cant have 13th month)
I get printed
Joe - May, 5. 2000
Joe - June, 6. 2000
Joe - July, 7. 2000
Joe - August, 8. 2000
Joe - September, 9. 2000
/edit
oop, my code is set up to print
Joe - 9, September. 2000
no biggie
edit/
Link to code
First ill give a rundown on what is supposed to be happening.
The program accepts an input of name as a character string, and a date (YYYY MM DD).
The date is copied into 3 variables year, month, day.
This is input in a function iohandling, and sent back to main.
Next, the function make_date takes this data and inputs it all into a DATE structure.
The next function date2str accepts this structure and converts the month value into a string referring to the # in month.
It also takes the struct and inputs ALL the data into a single string in the form:
NAME - "MONTH STRING", DD. YYYY.
This program will accept names and corresponding dates until an invalid date is entered or nothing is entered for name or date.
I have watched all the variables, and stepped throuugh the program and have found that the program works right, for a single input.
Then to get the data printed you have to enter null data, or invalid data.
The program will overwrite the structure of good data the array WAS pointing to with the null data....as well as fill the new structure the array is NOW pointing to with the null data.
If this is confusing....ill post the code here as well as an example output
if i enter 5 dates, say
Ryan
2000 05 05
Bill
2000 06 06
Jim
2000 07 07
Tom
2000 08 08
Joe
2000 09 09
Then nothing (NULL)
and nothing
I get printed
- May, 5. 2000
- June, 6. 2000
- July, 7. 2000
- August, 8. 2000
- September, 9. 2000
OR alternately
Ryan
2000 05 05
Bill
2000 06 06
Jim
2000 07 07
Tom
2000 08 08
Joe
2000 13 09 (cant have 13th month)
I get printed
Joe - May, 5. 2000
Joe - June, 6. 2000
Joe - July, 7. 2000
Joe - August, 8. 2000
Joe - September, 9. 2000
/edit
oop, my code is set up to print
Joe - 9, September. 2000
no biggie
edit/
Link to code