CS 1511 FAQ (Frequently Asked Questions)

Fall 2000

Updated 9/25/2000

Where do I hand in assignments?

There are mailboxes for each section in HH 314 which is open from 8am-8pm Monday through Thursday and 8am-4pm on Friday.

Can I get a copy of (Lab assignment, Programming Assignment, Class Notes, etc.)?

All class assignments are available on the class web page.

Where can I work on a program outside of my lab time?

You can go to any of the FULL access labs on campus that have IBM-compatible machines. For information on full access machines go to this web page. For a list of full access labs (note that some labs are scheduled for classes -- you can look at these schedules online) go to this web page.

Where can I get a copy of the software used in the labs?

You can buy a copy of the software from the Computer Corner (second floor of Kirby Student Center). They have two versions, one for approximately $50 and one for approximately $100. You may also want to check out Borland's web page. They are offering a free copy of the latest compiler (without the accompanying development environment). If you are very comfortable with Windows you may be able to get by with just the compiler.

Which version of CBuilder should I buy from the Computer Corner?

There is no easy answer. The less expensive version should handle all your needs for this class and for 1521. You may want to consider buying the more expensive version if you plan to build Windows software with your compiler.

May I use other compilers?

Any C compatible compiler is fine. This includes other products such as Visual C++.

The CBuilder available from the Computer Corner is version 5.0, does this matter?

It does introduce some differences. The steps taken to set up a program to compile can be found at the following link.

NOTE: At least one person has found that clicking the button next to C rather than the one next to C++ in the Console Wizard window removes some linker errors. If you try this I also suggest you remove the line:

#include <vcl.h>

Can I hand in assignments on-line?

No. You must turn in a hard copy. Electronic submissions create a number of problems and also require the TAs to spend significant time printing these submissions out for grading purposes.

Are you going to curve the score for (Program X, Exam X, etc.)?

No. Your total score is simply the sum of all of the points you accumulate on the various assignments/exams. But I will take into account the overall difficulty of the various assignments/exams when determining how many points it requires to achieve a particular grade.

What does it take to get grade X?

The only hard and fast rules are these: 90% guarantees an A-, 80% a B-, 65% a C-. These levels will never go up, though they may come down (e.g., the break for an A- has definitely slipped below 90% in past years). I am unlikely to give a passing grade (D) to anyone who accumulates less than 50% of the points in the course (generally I start the F/D break at 60%, but it may move). Generally the lines used to break grades up are affected by the difficulty of the course measured by average scores on various sections and my judgement of these averages. You may want to look at grade breakdowns from previous years to determine how this works.

Where/when is exam 1, exam 2 or the final to be held?

Exams are always held in the lecture room unless otherwise noted. The times for midterms as well as the final are contained in the syllabus (which is on-line).

My program output disappears from the screen. What do I do?

In C++ Builder and Visual C++, when the program ends the output window also disappears. What you need to do is cause the program to pause at the end while you make a copy of the output. The following lines of code can solve this problem:
  printf("Press return to finish.");
  fflush(stdin);
  getchar();

Some of my program output is lost because it fills more than the screen. What do I do?

Try to copy part of the output while the programming is running. For example, if the first part of the output involves prompts for input copy the output after a screen full of output has occurred to an editor such as Notebook. Then let the program continue and copy the rest of the output.

I get the following error X and my code looks ok. What do I do?

First off, be aware that only the first error the compiler tells you about is definitely an error. When compiling your program, if the compiler encounters an error it will go on looking at the rest of your code. But if the first error means something important has been left out, the compiler may see the rest of your code as having errors when in fact the problem is only with the first error. So fix the first error and try to compile again.

Another key thing to remember is that the line where the computer says the error occurred may in fact be after the line with the error. If for example, you leave out a semi-colon (;) you will likely get an error message not on the line with the missing semi-colon but on the next line. Remember to look at the previous lines of your code if you get an error message.

Do I have to use the main function shown in program 3?

Yes, you should simply copy this function and then replace the ...s with the correct arguments for your functions (plus add more variables as you need them). Note that you have 3 or 4 calls to many of the functions (for example, you call GetRawScores three times, once with the variables associated with student 1, once for student 2 and once for student 3). To write these functions, try to figure out what piece of code is being repeated each time and use that in defining the function.

I could write program 3 without the function calls, but I am not sure how the functions would work, how do I get started?

If you think you can come up with the base statements as if you were writing program 2 I would try to write down the set of statements that go with each function call in the main program (what statements for example would prompt for and read in the student 1 data). Once you have done this look at each group of statments and try to figure out what is similar about each group of statements and what variables they use or change. Anything they use or change would need to be an argument to (and have a parameter in) the corresponding function. Then try converting the groups of similar statements into one set of statements corresponding to that function. For example, imageine you had three sets of statements:
  printf("What is the id and age of student 1? ");
  scanf("%d %d",&id1,&age1);

  printf("What is the id and age of student 2? ");
  scanf("%d %d",&id2,&age2);

  printf("What is the id and age of student 3? ");
  scanf("%d %d",&id3,&age3);
Note that each set of statements is pretty much the same. They differ in which variables the values are read into (and the student # being prompted for). If we expected to call a function GetStudentData to take care of each student, information that would have to be passed to that function would be the address of the id and age variable for the appropriate student.

Thus we could replace our three sets of printf/scanf statements with three function calls:

  GetStudentData(&id1,&age1);
  GetStudentData(&id2,&age2);
  GetStudentData(&id3,&age3);
Then we make the corresponding function. Since the function doesn't calculate anything, we have a void return type.

Since there are two reference arguments we need two reference parameters (one for the id num and one for age).

The body of the function then does the printf/scanf command but with respect to the reference parameters (which are in turn connected to the three different pairs of variables in the three calls).

This gives us a function:

void GetStudentData (int *id, int *age) {
  printf("What is the id and age of student X? ");
  scanf("%d %d",id,age);
}
Note that I don't yet have a way for printing out the right student # (I put an X in the printf). I will leave this for you to figure out. As a hint, I suggest adding another argument and corresponding parameter to the function call and definition.

Is there a sample of the type of program I need to write in program 3?

One of your industrious TAs wrote a sample solution to program 2 using functions. It can be found at this link. I would recommend looking at this program only as a last resort since some of the ideas used in it are NOT how you should approach program 3.

Where do I get help?

You can come and see me during my office hours (see the syllabus) or email me (rmaclin) to make an appointment. You can also see your TA or any of the TAs during their office hours or email them for an appointment. You can also go to the Tutoring Center.

Borland C developer does not have rint in its math library, what do I do?

For the purposes of homework questions and the exams, you may assume that rint does work (you need not write working code for homeworks or exams). If you need something like rint, and you have floor available you can do something like the following:
  double my_rint (double num) {
    return floor(num + 0.5);
  }
Though this solution always rounds up for numbers like 0.5, 1.5, 2.5, etc. (a better solution would round up half the time and down the other half -- and you could alter the code above to do so).