one error in the program...

This is a discussion on one error in the program... within the C++ Programming forums, part of the General Programming Boards category; I haven't finish this program, but i got an error during compiling.(I try to get one part of the program ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    56

    Unhappy one error in the program...

    I haven't finish this program, but i got an error during compiling.(I try to get one part of the program working...)

    i don't know why.

    Please help
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    56
    here is one of my problem(the error) with this program, i don't know how to...well i don't have a word for that, therefore i can show you an example here:

    i have no problem to create a simple function like this...

    function prototype
    int main()
    {
    int number;
    char word;
    ...
    ...
    ....
    }

    void Calculatething(int number, char word)
    {
    ...
    }


    but i have problem with that:

    function prototype
    int main()
    {
    typedef string [30];
    string name[100];
    int number;
    ....
    }

    void Calculatething(int number, ??? name)
    {
    ...
    }


    hope you guys understand my bad explanation....

  3. #3
    cereal killer dP munky's Avatar
    Join Date
    Nov 2002
    Posts
    655
    my best guess is when you declaired your variable defined it like this: char name[100][30]; in your function, youre only passing in a char [], basically, you created a two dimensional array and are trying to pass it into a function that is accepting a one dimensional array

    hope i didnt lose ya
    guns dont kill people, abortion clinics kill people.

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    56
    unfortunately, my teacher didn't start teaching the "real" 2 dimention array "arr[] []" form.

    so i have to use the "typedef", so how can i pass to the function?

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    u have a nother file that u open?

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    it will work if you change the typedefs to plain chars like this




    int choice=0;
    int num[100];
    int length1;

    char namestring[30];
    char name[100];
    char last[100];

    char string[10];
    char gend[100];
    char pass[20];

    then on your pass
    use cin.getline()

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    56
    well...
    my teacher said to use typedef....


    anyway, here is my .txt file that the program will open..
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21