Mihai's CS368-3 (Fall 1999):
C++ for Java Programmers

The Computer Science 368-3 course covers C++ and is for students with previous Java experience. This page is not the main class page. The main class page used to be found at:

http://www.cs.wisc.edu/~cs368-3/SECTION3/cs368.html
Please refer to that page before asking any questions.

Below you will find questions and answers related to the on-line lessons, the homework, and the programming assignments. The questions are listed by date, with the most recent at the top. Please check the whole list of questions before contacting the TA or the professor. Thanks.

Thu Nov 18, 1999

Q:
About programming assignment #1:
Is the average read from the input file, or do I have to compute it?
A:
You have to computer the average for each student. The input file contains the following information (not all on one line):

<9-digit student id> <grade 1> <grade 2> ... <grade #NUMGRADES>

(the angle brackets <, > are NOT part of the format, they just delimit the information in the line above).

Thu Nov 18, 1999

Q:
About programming assignment #1:
What would be a reasonable MAX_STUDENT size for the size of my array of students?
A:
You can assume there will not be more than 100 student records in the input file. That limits the number of students to the range 0 - 100.

Wed Nov 10, 1999

Q:
Wed Nov 10, 1999
A:
Once you edited your files, use the following command:

% g++ -g -W -Wall <source files>

This will compile the C++ files given on the command line and, if successful, it will create an executable named a.out. To run the executable, just type:

% ./a.out

The options given to g++ are as follows:

-g : compile with debug information. Useful if you plan to run the debugger on your program.
-W -Wall : print out warnings during compilation. This is make g++ print warnings about your code. In some cases, the warnings are false, but most of the time it is a good idea to go back to the source and fix it.

Sometimes you want g++ to create an executable with a certain name, not the generic a.out. To do this, use the -o option:

% g++ -g -W -Wall <source files> -o <executable name>

This will create an executable with the name you specified.

Examples:

% g++ -g -W -Wall file1.C
    compile file1.C with debug information and warnings and put the executable in file a.out.

% g++ -g file1.C
    compile file1.C with debug information, but without warnings, and put the executable in file a.out.

% g++ file1.C -o file1
    compile file1.C without debug information, and without warnings, and put the executable in file file1.

Wed Nov 11, 1999

Q:
How do I turn-in my solution?
A:
The turn-in amounts to no more than copying the required solution files in the correct turn-in directory. Here is what you need to do:
  1. put your solution file(s) in your CS private directory (~/private/)

    If your solution file(s) is/are on a computer outside the CSL lab (your home computer, for example), you can FTP the files to your CS private directory. For more information on that please check the CSL page http://www.cs.wisc.edu/csl/doc/howto/remote/index.html.

    If you create your solution files on an NT CSL computer, save the files in the U:\private directory.

    If you create your solution files on an Unix CSL computer, save the files in your private directory (~/private/).

  2. open a terminal on one of the nova computers

    You can do that remotely, by ssh or telnet, or by logging in to any of the nova machines in the CSL Unix lab.

    If you are on the nova machines in the CSL Unix lab, open an xterm.

  3. make sure you are in your private directory

    Type the following at the terminal command line:

    % cd ~/private/

    (note: % is part of the prompt, you do not have to type it)

  4. copy the solution file(s) to the turnin directory

    Type the following at the terminal command line:

    % cp <files> <turn-in path>

  5. check whether the files were copied

    Type the following at the terminal command line:

    % ls <turn-in path>

    You should see the solution file(s) required by the assignment.

That's it!

<files> is the list of files you have to turn in, named as required by the assignment. For example, for Written Assignment #1, there is only one file to turn in, named hw1.

<turn-in path> is the name of the directory you have to turn in your files into, as specified by the assignment. For example, for Written Assignment #1, the turn-in path is ~cs368-3/public/SECTION3/turnin/HW1/<your login name>.

If I turned in my HW1 solution, I would do the following:
  • edit the file hw1 and save it in ~/private/
  • % cd ~/private/
  • % cp hw1 ~cs368-3/public/SECTION3/turnin/HW1/mihai
  • % ls ~cs368-3/public/SECTION3/turnin/HW1/mihai

Thu Nov 11, 1999

Q:
I took some Computer Science classes a while ago. Now, whatever accounts I had there are expired. But in order to use the computers at CS for this course, I need to have a login... so what should I do?
A:
Your account with the CS department should have been reactivated. Try logging in to one of the machines in the CS labs.

If that does not work, or if you forgot your password, please go to the CSL office, 2350 Computer Sciences and Statistics, and have your account activated asap.

Copyright 1998-2005 Mihai Christodorescu. All rights reserved.
Maintained by Mihai Christodorescu (http://mihai.christodorescu.org).
Created: Mon Dec 21 21:12:13 PST 1998
Last modified: Sat Oct 1 23:06:25 CDT 2005