Thread: need ur assistance

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    1

    Question I need your assistance

    help me run this program: a program that asks from the user the ff. data:
    -full name
    -address
    -age
    -birhtday
    -course
    -year level

    *and store each user record in an array, prints the contents of the array in the order of occurence.

    *the program must have at least two functions:
    a.) input_data() - gets the info. from the user
    b.) print)data() - prints the contents of all user records.

    *don't use global variables
    *have back up file can be in notepad or word.

    SAMPLE RUN:

    Enter record #1:
    full name:____
    address:_____
    age:___
    birthday:_____
    course:______
    year level:_____

    Do you want to enter another record? (Y/N)

    if No, record will be printed.

    ==============================================
    this is what i make pls. i need ur suggestions and corrections:

    Code:
    #include <conio.h>
    #include <stdio.h>
    #define MAX 50
    
    typedef struct
    {
      Char Name [70];
      Char Address [100];
      int age;
      Char birthday [20];
      Char course [10];
      int year level;
    } datatype
      void input_data (datatype L [MAX]);
      void print_data (datatype L [MAX]);
      void main (void)
    {
      datatype L [MAX];
      clrscr ();
      input_data (L);
      print_data (L);
      getch ();
    }
    void input_data (datatype *L)
    {
    int i;
    for (i = 0; i ,MAX; i#)
     {
      printf ("Input data for users %d\n", i + 1);
      printf ("Name:");
      gets (L [i].Name);
      printf ("Address:");
      gets (L [i].Address);
      printf ("Age:");
      gets (L [i].Age);
      printf ("Birthday:");
      gets (L [i].Birthday);
      printf ("Course:");
      gets (L [i].Course);
      printf ("Year Level:");
      gets (L [i].Year Level);
     }
    }
    void print_data (datatype *L)
    {
    ??????????????? don't know what to do next pls. heeeeeelp
    Last edited by Salem; 06-21-2006 at 12:52 AM. Reason: fixing code tags, and horrid grammar

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    This is C, not C++. It has non standard code, several errors in case-sensitivity, improper arguments in the functions, a missing semicolon, a main that returns void when it should return int... basically a whole lot of things you can fix simply by listening to what your compiler is telling you.

    Also, the homework policy doesn't allow us to do much as far as fixing your code.
    Sent from my iPadŽ

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > for (i = 0; i ,MAX; i#)
    Have you even tried compiling this yet?

    Maybe
    for (i = 0; i < MAX; i++ )

    > void input_data (datatype L [MAX]);
    > void input_data (datatype *L)
    Yes, pedantically, they are the same.
    But prototypes and definitions should match

    > void print_data (datatype *L)
    > don't know what to do next pls
    You could start with the same for loop which read data in, and maybe a printf() statement

    > void main (void)
    Main returns an int - see the FAQ

    > gets (L [i].Name);
    Never use gets(), always use fgets()
    This too is in the FAQ
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    char is all lowercase. All C89 keywords are lowercase (_Bool is C99).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Variable Timer assistance
    By rich2852 in forum C Programming
    Replies: 2
    Last Post: 01-21-2009, 05:43 AM
  2. Need ur help
    By code_red_009 in forum Windows Programming
    Replies: 1
    Last Post: 07-08-2005, 07:33 AM
  3. bill gates and ur mom
    By Darkness in forum A Brief History of Cprogramming.com
    Replies: 35
    Last Post: 03-30-2005, 11:44 AM
  4. where do u get ur inspiration for ur appilcation?
    By poopy_pants2 in forum Windows Programming
    Replies: 5
    Last Post: 04-05-2003, 10:08 PM
  5. need ur opinion about home study
    By moemen ahmed in forum C++ Programming
    Replies: 12
    Last Post: 07-13-2002, 10:19 AM