352 News (Information)

 Final Grades are IN
Posted on Saturday December 11, 12:24PM
I have finished grading the final and assigned final grades. You can check out the final exam with solutions an comments, as well as the final grades for the course.

First of all, I would like to sincerely congratulate those of you who worked hard and received a good grade on this class. I know that for many of you this was more work than you had anticipated. Unfortunately, as I keep repeating, the only way to learn to program is by programming, a lot. This requires one to spend a lot of often frustating hours in front of the computer. However, there is no other way around it. Many of you rose to the challenge and now possess the mental tools needed to tackle a wide range of software engineering problems. Good deal!

On the other hand, there are some who only seem to have a rudimentary knowledge of C++ and data structures. The grades reflect this.

I also want to apologize for making the exams include so much programming. I realize that making someone write a small program under such a tight deadline is a form of torture (in the business world it is known as a "death march") but it is the only way I can determine which students have actually done the homeworks. In a perfect world I would base the grade solely on your problems sets. Alas, given the current "culture" that would not be fair to the students that actually perform the work. So, I have to submit these same students to the exam torture. I wish there was a better a way.

Anyway, I had a lot of fun teaching this class. I hope you all got your money's worth.

Happy Holidays!

You can pick up your final outside my office, some have comments on them.

 Final Exam in Amoco Hall
Posted on Tuesday November 30, 12:23PM
The final exam will be held in the Amoco Hall on Thursday December 9 at 9am. You will have 3 hours. Please be there on time.

 Grades after Exam 2
Posted on Tuesday November 09, 01:23PM
I realize many of you are concerned about your grades. As I said in class, since the final is comprehensive if you do well in the final I will take that into consideration when assigning final grades. That is, a good grade on the final might help you move up one letter grade higher than you would have otherwise received, if you were close enough to start with.

I cannot stress enough the importance of doing the problem sets. The only way to learn C++ is by actually using it, a lot. I realize that this is very time consuming but no one has yet found a better way. Also, the knowledge you learn with each program you write is cummulative. That is, you always learn something new, even after years of programming.

Finally, I have generated a graph with your current grade distributions. These are your current grades using PS1--PS8, exam 1, and exam 2, using their respective weights. For the PSs I just took the average of PS1--PS8 and did not eliminate the lowest two grades. This means that you can probably expect the the actual grades to be a bit higher, especially since many of you chose not to do PS8.

 Test Location
Posted on Monday November 01, 09:56AM
As I mentioned in class, the next test will be held in room 3C01 in Swearingen, be there, early!

 Fun Stuff: TV for Geeks
Posted on Tuesday October 26, 05:08PM
I just came across Dr. Dobb's technetcast which has video and audio interviews with luminaries from the software engineering field. I recommend the interview with Stroustrup (you know, the father of C++). As a bonus, you will hear how to correctly pronounce his name.

 About Compiler Warnings
Posted on Monday October 25, 04:28PM
Because of the number of containers and, therefore, templates that you need to use for PS8, VC++ might give you a lot of warnings about names being too long and getting truncated. Basically, the debugger can only handle function/variable names that are up to 256 characters long and you are exceeding that limit. Only the first 256 characters are used. You will get one warning for each function/variable that exceeds this limit.

This is not a problem. In fact, there is nothing you can do about it. In general, we will not deduct any points for warnings, altough you should pay attention to them because they often point to possible bugs in your program (not in this case).

 AVL Tree Animation
Posted on Thursday October 21, 11:00AM
I found an applet that animates AVL trees. However, it does not clearly show which node is unbalanced and what rotations are performed. Remember that you must find the deepest unbalanced node and that node will be the "root" of the template tree for rotations (the one I showed in class), which you use to determine wheter the new node was added on the "inside" (double rotation) or on the "outsise" (single rotation).

 PS8 Hints
Posted on Wednesday October 20, 02:47PM
First, remember what I said in class: "A topic section is a node, a node is a file." Once you have this insight, its just a matter of writing the code :-)

Also, the following code does not work.

string filename = "hello.html";
ofstream ofs(filename);
ofstream only takes an argument of type "const char *". You must instead use the following code (which converts the string into a "const char *":
string filename = "hello.html";
ofstream ofs(filename.c_str());
Update: Thursday October 21, 02:31PM. You can also use the
string::size_type string::rfind(string)
function to find a particular substring (say, "/") of a string starting from the end (right hand side) of the string. You can also extract a substring of a string using the function
string string::substr(string::size_type start, string::size_type length)
Please consult your favority STL book and the Help Sources section in here (specifically, the string information).

 Error in PS7
Posted on Thursday October 14, 11:06AM
There was an error in the main.cpp comments on PS7. I have used new sample lists (i1 and i2) in order to show how the merge function you implement is supposed to merge to sorted lists into one new sorted list. The PS7 has been updated. The code that changed is the following:
	List<int> i1;
	i1.push_back(5); i1.push_back(7); i1.push_back(15); i1.push_back(28);
	List<int> i2;
	i2.push_back(2); i2.push_back(6); i2.push_back(8); i2.push_back(21);
	i1.merge(i2); //i1 and i2 are sorted, the new i1 should also be sorted.
	cout << i1 << endl; //prints 2 5 6 7 8 15 21 28 
	cout << i2 << endl; //prints 2 6 8 21
 New Cover Sheet for Problem Sets
Posted on Tuesday October 12, 12:14PM
To make things more uniform, and to document your adherence to the USC Code of Student Academic Responsibility, all problem sets (starting with PS7) will be handed in with this coversheet. You must fill out the cover sheet and sign it, showing that you have not received any unauthorized help in the problem set.

Note:Failure to use the cover sheet (with signature) will result in an automatic loss of 50 points.

 Iterators on PS5
Posted on Tuesday September 28, 02:39PM
While doing PS5 it will really help you to remember that now low and high are iterators their meanings are changed from the examples in the book. That is, they are now "pointers" to the first element in the current list and to "one beyond" the last element.

I should also mention that you cannot add two iterators. However, you can substract two iterators, but the result is an integer, as such:

vector<int>::iterator i1;
vector<int>::iterator i2;

//some other code in here

int distance = i2 - i1; //distance is the number of elements
                        //between i2 and i1.

vector<int>::iterator i3 = i2 + 5; //i3 points to the element 5 places after i2.

 The digital workforce and other stuff
Posted on Tuesday September 28, 11:25AM
I have a couple of things:
  1. Here is the link to the Digital Workforce report. It is highly informative: job titles, salaries, skills in demand, etc.
  2. I want to encourage more of you to post your questions or musings to the forum. Note that you do not need to use your full (or even real) name, if you feel that it will help you ask needed questions. I would also like to get some feedback/discussion on how the class is going, how much you are learning, what would you change, etc.
  3. You can see the grade distribution for Exam 1 on the left. Those of you who did not show up for class (shame on you :-) Ive placed your tests right outside my office.

 Problems downloading files
Posted on Friday September 24, 09:55AM
There is a problem with the setup of Internet Explorer in rooms 1D15 and 1D11. Basically, IE will not allow you download files (specifically, Word documents). Matt Byrd is in charge of maintaining those labs and is working to fix this problem. In the meantime, try using another lab. Update: Friday September 24, 02:41PM David London tells me that the same problem is affecting the NCR lab. He is working on fixing it.

 Hurricane Floyd
Posted on Tuesday September 14, 04:46PM
At this time, we don't know if there will be classes tomorrow or Thursday. You can check here for the latest official USC information on that. If we don't have class Thursday that will just mean that the material I would have covered then will not be on the Exam of next week. And, please, be safe and take care. Update: Thursday September 16, 09:40AM Well, we are back up. They turned off my computer so the webserver was not available yesterday, sorry about that. Since there is no class today the first test will cover everything we did up to last Tuesday. Next Tuesday will be a review. PLEASE bring any and all your questions to class, otherwise I might not have much to talk about.

On a completely unrelated note, I just came across this article about Don E. Knuth, which I thought you might find interesting.

 Problems with PS2
Posted on Monday September 13, 12:37PM
First, because my question 2.1.3-2.1.6 was ambiguous (it was not clear, not even to me, whether I meant days or months) we decided to give everyone full credit. Still, you should all see the solution. I will also cover it again on review day, the last class before the test.

Also, there are some errors that many of you keep making in your programs. You can avoid these errors by following these rules (graciously provided by Buddy):

  • Member variables should be private.
  • Destructors should be virtual.
  • In the constructors, members variables should be initialized or at least assigned.
  • Should use "const" when a function is not going to change a variable.
  • Should always implement default constructor.
  • Some people are declaring friend functions in the private section of the class declaration. This is wrong.

 Using member functions as arguments to sort
Posted on Friday September 10, 10:55AM
When trying to sort a container using sort(container.begin(), container.end(), compfunction) you should make sure that compfunction is a globally defined function. That is, it should not be a member function of some class. The C++ standard library explains how you can use member functions in these situations (you wrap them using mem_fun_ref). However, VC++ 6.0 has not implemented this feature correctly (i.e. it does not compile), so we will not be using it.

 PS1 Graded, procedure for handing back
Posted on Tuesday September 07, 02:35PM
PS1 has been graded. You can pick up your graded PS just outside my door. They will not be handed back in class, so you must drop by if you want it. I have posted the grade distribution, you can see it on the left menu.In the future, whenever I post the grades it will mean that I have also placed the graded problem sets outside my door.
Also, I think most of you did very well. Still, some of you are doing some pretty weird things. You should all read the comments Buddy wrote on your PS and study my solutions.

 PS3 Hints
Posted on Tuesday September 07, 11:02AM
I forgot to mention in the stringex.cc file that you can easily access the i'th element of a string, as such: (NOTE that the i'th element is of type char, not of type string.)
string s;
for (int i = 0; i< s.size(); i++)
  cout << s[i] << endl; //print letter at position i
 PS2 operator>> clarifications.
Posted on Thursday September 02, 03:13PM
I rewrote the description of how to implement operator>> is PS2. Hopefully its somewhat clearer now.

 Handing in Problem Sets, Part 2
Posted on Thursday September 02, 11:49AM
Well, it seems some of you are trying to make Buddy's life more difficult. I want to assure you that such behavior can only have a negative effect on his perception of your work. If you want to attain his favor, and not lose extra points, you will:
  1. Staple and order the printouts such that the header file comes before its corresponding .cpp file.
  2. Write your name and the name of the file at the top of each file.
  3. Include an explanation of any "out of the ordinary" things you have done. (you know who you are ;-)

 About postincrement++ and ++preincrement in for loops
Posted on Thursday September 02, 11:31AM
There appears to be some confusion about the effects of ++ on a for loop. I am not sure where it comes from but my "Deitel and Deitel" C++ book states in page 84 that ++counter, counter++, counter +=1, and counter = counter + 1 are all equivalent in the incrementing portion of the for structure. The increment expression in the for structure acts like a stand-alone statement at the end of the body of the for. The same is also true for iterators. Specifically, the 4 for loops in the program below all print "1 2 3" (try it and see!). If the confusion stems from some other use of the for loop, please email me.
using namespace std;

int main(int argc, char* argv[])
	list<int> l;
	list<int>::const_iterator li;
	//preincrement is faster because it does not require a
	// temporary object.
	for (li = l.begin(); li != l.end(); ++li){ //prints 1 2 3
		cout << *li << " "; 
	cout << endl;
	for (li = l.begin(); li != l.end(); li++){ //prints 1 2 3
		cout << *li << " ";
	cout << endl;
	int i;
	for (i =1; i < 4; ++i){ //prints 1 2 3
		cout << i << " ";
	cout << endl;
	for (i =1; i < 4; i++){ //prints 1 2 3
		cout << i << " ";
	return 0;

 Solutions to PS1 and others.
Posted on Wednesday September 01, 09:35AM
I have posted the solutions to PS1.You can see the link on the left. I have also created a directory called "Solutions" on the class folder (\\Engr_asu\ECE352\Solutions\) and placed another copy there. I will do this for all subsequent problem set solutions.

 About the Handing-in of Problem Sets
Posted on Tuesday August 31, 02:36PM
The printout of the problem sets is due at 9:30am, just before class. If you are not going to be able to wake up that early just slip the printout under my door the night before. I have not deducted the 20% for late problem sets this week, but next week I will have to.

 Hints for Using the Forum
Posted on Tuesday August 31, 10:56AM
It looks like many of you are reading the forum; this is good. I should mention a few hints on how to use it. First, you should give your question a descriptive subject, one that tells the other students what its all about. Also, note that there is a button "Older Messages" which shows the older messages that cannot fit on the first screen. There is also a "Collapse Threads" button which does what it says.

 Static Member Variable in Template Class
Posted on Friday August 27, 01:50PM
One of you asked me how to initialize static member variables in a template class. I have the answer now. (you do not need to do this for PS 1 or 2). Here is an example of how to do it: (Quiz: whats the difference between a static member variable and a regular one?)
template<class Etype> class Sec {
	static int count;

template<class Etype>
int Sec<Etype>::count = 10;
 VC++ Bug: Templates Class Functions must be Defined in Header
Posted on Tuesday August 24, 02:38PM
When implementing the portfolio template class for PS1, place all the function definitions in the header file. Otherwise, the program will not compile since VC++ does not support the export keyword. I will explain this in class on Thursday 26.

 Bug in PS1 Handout
Posted on Friday August 20, 09:49AM
There is a bug in the printout I gave you of PS1. It uses "#include <iostream.h>" instead of "#include <iostream>", "using namespace std;". I have fixed this on the online version.

 Other Help on C++
Posted on Thursday August 19, 05:02PM
I moved all the "other help" pointers to their own page. I highly recommend you read the C++ review documents (in the "other help" page, they are much better than my slides), as well as the Appendix A in the book. Even if you know C++ you will find it useful to review them.

 VC++ Bug: friend functions cannot access private data members
Posted on Thursday August 19, 11:52AM
If you try to place a "using namespace std;" before a friend declaration VC++ 6.0 will not let you access the private data members from the friend function, even thought you should be able to (they are friends). Microsoft provides a patch. You can either apply this patch to VC++ 6.0, or go to the patch page and look at Test1.cpp for a simple workaround. It aint pretty, but it works.

 352 Folders for Handing-in Problem Sets
Posted on Thursday August 19, 11:45AM
If you do not find your username in the homework folders (as detailed above), please tell me as soon as possible. Not having a folder will not be a valid excuse for a late homework. For those of you who did not attend class (and I hope there are not many) note that we changed the meeting room (see above). The old room was too small to fit all of us.

Jose M. Vidal
Last modified: Sat Dec 11 12:47:38 EST 1999