Thread: Student records

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    26

    Student records

    Code:
    # include <stdio.h>
    # include <conio.h>
    # include <string.h>
    
        int main ();
    
    	struct RecordInfo{char Student_Name[25];
    					  int  id_num[10];
    					  int  Tel.Num[7];
    					  char Address[40];
    					  char Program[15];
    	};
    	struct DOB{ int dd/mm/yyyy
    	};
    	// Function Prototype
    
    		void RecordInfo(RecordInfo);
    
    		void main (void) {
    
    			RecordInfo Student_Name;
    			RecordInfo (Student_Name);
    
    			getch();
    
    		}
    
    		void RecordInfo(Student_Name s){
    
    			printf("Enter name & id_num");
    			scanf("%d, %s"&s.name,s.id_num);
    
    			printf("Enter student's address");
    			scanf ("%c",& s.address);
    
    			printf("Enter student's D.O.B & Tel.Num");
    			scanf("%d %d",& s. D.O.B, s.Tel.Num);
    
    			printf("Enter student Program_Name");
    			scanf("%s",& s.Program);
    		}
    	};
    
    		int Update_Records;
      char Update[50];
      printf("Enter Name of the person you wish to change: ");
      scanf("%s", &name);
        for (int i=0;i<10;i++);
        {
            if (strcmp(name[i].FirstName) == 0);
            {
             printf("What do you want to Modify?\n");
             printf("Press 1. to edit Last Name\n Press 2. to edit First Name\n Press 3. to edit Id Num\n Press 4. to edit D.O.B\n Press 5. to edit Address\n Press to edit Telephone number\n Press 7. to edit Program Name\n");
             scanf("%d", &Update_Records);
             switch (Update) {
                 case 1:
                  printf("Enter the new Last Name: ");
                  scanf("%d", &students[i].Last Name);
                  break;
    
                case 2:
                 printf("Enter student's updated First Name: ");
                 scanf("%s", &RecordInfo[i].First Name);
                 break;
    
                case 3:
                 printf("Enter student's updated Id Num  : ");
                 scanf("%s", &RecordInfo[i].Id Num);
                 break;
    
                case 4:
                 printf("Enter student's updated Date of Birth: ");
                 scanf("%d", &students[i].DateOfBirth);
                 break;
    
                case 5:
                 printf("Enter student's updated Address: ");
                 scanf("%s", &students[i].Address);
                 break;
    
                case 6:
                 printf("Enter student's updated Telephone Number: ");
                 scanf("%s", &students[i].TelephoneNumber);
                 break;
    
                case 7:
                 printf("Enter new Program: ");
                 scanf("%s", &students[i].ProgramPursued);
                 break;
    
                default:
                 printf("Wrong entry\n");
                 break;
              }
        
            
          }
       }
    }
    
    I need it to be different than this

  2. #2
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    So are we supposed to guess as to what you want help with, or do you expect us to run the code and debug it for you and basically rewrite it for you as its really sloppy?

    Try again.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    its a course work n i dont want it to look like anybodys own so i need it to be different but know not a clue where to start

  4. #4
    Registered User
    Join Date
    Sep 2008
    Posts
    58
    Your first error right here.

    Code:
    struct DOB{ int dd/mm/yyyy
    	};

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    thats structure for the date of birth, thats the format they give me on the net in which which i must write it

  6. #6
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    You could start by trying whatever it is you're trying to do (instead of taking someone else's code which it sounds like you have done).

    Once you run into a problem then ask us for help, you need to come with a question of what it is you don't understand or are having trouble with, if it has to start with "what is int main()" then so be it.

  7. #7
    Registered User
    Join Date
    Sep 2008
    Posts
    58
    Quote Originally Posted by CoreLink View Post
    thats structure for the date of birth, thats the format they give me on the net in which which i must write it
    Um, when you print that data back, then you can put it in that format. You can't name an integer with "/" characters.

  8. #8
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    do you have any suggestions? The only part i took was the case structure part but it look too similar i need a different look...the rest is mine. I not sure if the structures part is right

  9. #9
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    so do you suggest i use a commas instead for the date of birth?

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    So...you need it to look different because you COPIED it, and don't want to get caught???

  11. #11
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    Quote Originally Posted by CoreLink View Post
    so do you suggest i use a commas instead for the date of birth?
    Well if you used commas yes you would have 3 variables one for day one for month and one for year, that would work, ie:

    Code:
    struct DOB { int dd,mm,yy; };
    That is the least of your worries though.

  12. #12
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    The structures is mine right but the case looks similiar to whats on the net, which i dont want it to be...i'm stuck at this point and i need to write to a file after

  13. #13
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    ok i did that but does the structure part look ok, jus have feeling that something wrong

  14. #14
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You don't need three threads for one topic.


    Quzah.
    Hope is the first step on the road to disappointment.

  15. #15
    Registered User
    Join Date
    Apr 2010
    Posts
    26
    no those were mistakes sorry pc froze thats why

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 03-03-2010, 01:33 AM
  2. Updating in a sequential file?
    By Ronnyv1 in forum C Programming
    Replies: 1
    Last Post: 03-24-2009, 04:41 PM
  3. reading a file into a block
    By mickey0 in forum C++ Programming
    Replies: 19
    Last Post: 05-03-2008, 05:53 AM
  4. Database assignment is Killing me!
    By Boltrig in forum C Programming
    Replies: 2
    Last Post: 11-29-2007, 03:56 AM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM

Tags for this Thread