Thread: initializes all components of failing to false

  1. #16
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Oh I stupid I missed something:
    Code:
    void Initialize(bool failing[])  ;
    void SetFailing(bool failing[],const int score[])  ;
    void SetPassing(bool passing[],const int score[])  ;
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  2. #17
    Registered User
    Join Date
    Jun 2003
    Posts
    73
    I get 23 errors and 1 warning when I add those semicolons to the three statements.

    Bryan

  3. #18
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I'm not doing so good today:
    Code:
    int score [NUM_STUDS};
    Any idea what that should be?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #19
    Registered User
    Join Date
    Jun 2003
    Posts
    73
    scores for 100 students....since the NUM_STUDS=100 above..at least I hope..hehhe

  5. #20
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    "if they want me to initialize all compoenets of failing to false, what exactly am I trying to do? I dont specify in this program what is passing or failling, that is a totally differenet program, and I kow if I did I would put >=60 ..stuff like that, but what exactly am I trying to find? that is what I dont understand..."

    If you were instructed to created a 15 element integer array in main(), and then call a function to set each of the elements to the number 5, could you do that? I suggest you try to do that as an exercise.

    When you declare an array like this:

    int numbers[15];

    the compiler sets aside space in memory for 15 integers. As an exercise, after declaring the above array, you should try displaying each element doing this:
    Code:
    for(int i = 0; i<15; i++)
       cout<<numbers[i]<<endl;
    If you do that, you will discover that each element contains a junk value. Therefore, typically programmers "initialize" their arrays with some value like 0 for instance.

    In your case, your array is of type bool. A variable of type bool can have one of two values: true or false. For instance,

    bool my_variable = false;

    or

    bool my_variable = true;

    and an array of type bool like,

    bool my_array[10];

    is made up of elements my_array[0], my_array[1], ....my_array[9] which are all of type bool. Your instructions are to create an array of type bool and call a function to initialize every element of the array to false. That means you have to create the array in main(), send it to the function, and inside the function set each element to false, like this:

    my_array[0]=false;
    ....
    etc.

    YOu shouldn't be worrying about the scores at this point, and when you do incorporate the scores you should create a file with 3 scores and get that to work before trying a file with 100 scores.

    Finally, based on your inability to see the glaring syntax error the previous post tried to point out, I am going to surmise that this program is way over your head. You have to be able to successfully program and debug simple hello world type problems with only a few lines of code before trying bigger programs or you won't be able to figure out what's wrong. For instance, things like semi-colons at the end of statements are not optional in C++.

    Good luck.
    Last edited by 7stud; 08-01-2003 at 09:15 PM.

  6. #21
    Registered User
    Join Date
    Jun 2003
    Posts
    73
    I wish I had a choice...I am just trying to do my assignemnts every week. Its a learning experience and since I do this online its alot harder not having a teacher help explain it to me. thanks for all the input though.

    This assignment is due in 35 min. Otherwise I get a late point, would someone just highlight where I need to focus on so I can find a way to chage that part of the program. I know people dont like just giving answers becuase that is not helping anyone but I just need to get this done and it also helps me learn by looking over what I did and learning from the errors. If not, thats cool, thanks anyways.

    Bryan

  7. #22
    Registered User
    Join Date
    Jun 2003
    Posts
    73
    also, I added those three semiclons back and fixed the void statement that had a
    Code:
    }
    I needed a
    Code:
    ]
    ...I messed up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. the chess project
    By Hussain Hani in forum Projects and Job Recruitment
    Replies: 8
    Last Post: 05-28-2007, 02:33 AM
  2. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM