Please notice the change in time for Friday's office hours.
(The time has been changed from 1-2 to 2-3)
April 27, 8:30 am
Please notice the change in time for Monday's office hours.
(The time has been changed from 1:15-2:15 to 12:00-1:00)
April 26, 8:20 am
Here are the topics
for the third exam. Once again, you may bring one 8.5 by 11 inch
piece of paper with notes.
Make sure you have studied the example restaurant program that can
be found on the examples page.
Office hours:
Monday, April 28, 12-1
Tuesday, April 29, 1;15-2:15
Wednesday, April 30, 11-12
Thursday, May 1, 12-1 (NOT 1:15-2:15)
Friday, May 2, 2-3
Monday, May 3, 11-12
April 25, 11:45 am
On the examples page I put up the program that will be on the final.
Copy it. Print it. Run it. Discuss it.
April 22, midnight
The final exam is on Thursday, May 1, not Monday. The room has
not yet been set.
April 22, 10:00 pm
In order to make both HW pages agree, I have set the final project
due date as Tuesday, May 6.
April 3, 10:45 am
I have made some slight modifications to hw6. Please see the
hw6 page and make sure you see the note in red
at the top of the page.
March 25, 4:45 pm
There is a typo in the homework. In part c when I talk of the
Book class I really mean the Medication class! (The error has been
fixed on the hw page.)
March 25, 4:15pm
To read in the file name for hw5 you have a few choices.
The constructor ifstream myfile(file_name);
expects an old fashioned c-string, that is, an array of char.
One choice is to use an array of char, use cin>>that_array_name and
then pass that_array_name to the ifstream constructor.
The other choice is to use a C++ string, and pass to the ifstream constructor
the underlying c-string which you can get using the function
s.c_str()
where s is the string. [Think, some member data of C++ string
is an array of char, and c_str() is the "get" function that returns that
array of char.]
There will be no class on Thursday, April 17.
March 20, 11:20 pm
Topics
for exam 2
Also recall that hw 5 is due on March 27, not the 25th.
March 18, 4:15 pm
On the examples page I put up a sheet that talks about strings (C++
strings, not C strings) You will need getline to read white space
from the file.
March 1, 8:15 am
Here is a Rationals class header
and implimentation
that you may use in assignment 4. You may use your own version of
the class, or put together a new combined version. If you use your own
class you will need to modify the input and output to accomodate files.
I present the member functions
istream& Rational::read(istream & infile);
ostream& Rational::printquotient(ostream & outfile);
ostream& Rational::printdecimal(ostream & outfile);
As an example, in the program I wrote to create the file your program will use for input, I had the code
ofstream myout("problems2.txt");
Rational r,s;
//code that sets values
for r and s
r.printquotient(myout);
myout << ' ' << pickanop() <<
' '; //pickanop() is a function that returns a char +, -, *, or /
s.printquotient(myout);
myout << endl;
You may want something like this when teaching the computer how to output
an equation.
You will not want something like this in your main, because
by then the computer will already know how to output a whole equation.
You may find the class even easier to use if you change these i/o functions
to non-member friend functions
istream& operator>>(istream & infile, Rational r);
ostream& operator<<(ostream & outfile, Rational r);
//for printquotient. This assignment doesn't use printdecimal.
If you like, you may change the read and print functions for the Equation class into friend operator functions.
Another note:
You may assume that the file of equations has no more than 100 equations.
February 28, 12:15 am
The parameter of the set function should be changed from op to oper
so as not to conflict with the name of the local variable.
I have put up a sample file for fractiondata.txt. A link has been added to the hw4 page.
February 25, 10:30 pm
Some comments on HW 4.
theOps and Operation:
What you will be storing as member data is an integer for the operation.
The only integers it can be are 0, 1, 2, and 3 because we have created
a special "type" called Operation. When it comes time to print out
an equation, you don't want to print 1 for minus, you want to print -.
You will notice that, if you rig it as suggested, theOps[minus] is the
symbol -. For the time being, make theOps ordinary member data -
remove the work static. We will discuss static next class.
withAnswer:
For the time being remove static from the description of withAnswer.
You can make it static once we discuss static. The print function
looks at the value of withAnswer to know if it should be printing with
answers or without answers.
patch for VC++
If you have succeeded in applying the patch, let me know which patch
and how you installed it. Some others have questions or problems.
February 25, 8:00 pm
If you are getting an error that says >> ambiguous or something
like that, you may have a problem with the VC++ bug for friends in namespace
std.
Easy get around:
#include<iostream.h> instead of
#include<iostream>
and get rid of
using namespace std;
(You have to use .h for all your header files)
Long term solution:
Go to Microsoft's web site and install the patch.
http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp
February 12, 7:15 pm
The sections refered to on the Topics page are from the 3rd edition
of Deitel and Deitel.
February 10, 10:30 pm
There is a new proceedure for submitting homework. You create
your project and zip it exactly as you did before. Now go to
https://www.ecs.syr.edu/faculty/baruch/upload.cfm
You will be asked for your ecs user name and your NT password.
(You must have one. Go to the cit office and get one if you don't
have one.) Follow the instructions for uploading the file.
The old homework account will be gone. Send e-mail directly to Dr. Baruch or Prateek if you have questions to ask.
February 6, 9:30 pm
Topics
for exam 1.
The exam is closed book, but you may bring an 8.5 in x 11 in piece
of paper with anything you like on it.
You may bring a foreign language dictionary, but you may not share
dictionaries.
Bring pencils, pens, erasers, ... You may not share during the exam.
On the exam there may be
int a, b; cout << "Please enter two integers:"; cin >> a >> b; cout << "Their sum is " << a+b << endl;
February 6, 8:30 pm
How did I get that answer! Sorry for the error.
318/234=53/39, not whatever I had on the page before.
318/6=53 234/6=39.
January 30, 10:15 am
The homework (hw 2) has been modified to have the user choose the number
of candies in each row. Make sure you have a copy of the updated
assignment.
January 14, 11:00 pm
Prateeks e-mail on the syllabus page has been changed. Please
note the new address. Also his office hours have been posted.