|
-
Clueless on C++
How do I rewrite the following statement a two statements without usingcompund or increment operators
count += k++
How do I solve these programs for C++
An integer contant dayofWeek1 has a value between 0 and 6 and represnts the day of the week for Janurary 1st (0 = Sunday, 1 = Monday, etc.). A variable day has a value between 1 and 31 an represents a day in Januray. How do I write and expression that calculates the day of the week for any given value of day. For example, if dayofWeek1 = 0 (Janurary 1st is a Sunday) and day = 13 (Janurary 13t), then dayofWeek, the day of week for Janurary13th, should get a value of 5(Friday).
int dayofWeek = ________________________
Another program I am clueless on:
curHour and curMi representthe current time and depHour, depMin represent the departure time of the bus; both are between 1 and 11 p.m. How do I solve it if I already have the following statements. This has to display the remaining wastin time in hours and minute:
int____________=
______________________________________
______________________________________
cout <<_________________<< " hours and "
<<_________________<< " minutes.\n";
-
Right. If you don't know these, you should probably tell your instructor that and ask for help, instead of trying to get us to do your homework.
-
Ursus Arctos Moderatis
My feelings exactly. Manning, in the future please do not spam this message board with your homework assignments. The intended purpose of this forum is not "Do Manning's homework for him", rather, it's for open discussion on programming & scripting related topics.
[Note]
Manning's 4 other homework problems have been removed from this forum. People on occassion post problems they run into with CS assignments, which is all well and good. But you cross the line when you post 5 homework assignments all at once.
[This message has been edited by Grizzly (edited December 02, 2001).]
-
Agreed, this is not the "Do Manning's Homework Forum", it's the "Help Sicko With His Projects So He Doesn't Get Fired Forum".
With your first one (if I understand it correctly), look at it, you're trying to do 2 different/main things, increment a variable, and a addition. Figure out what order they occure in and then write them out in the proper order. To do this simply read the chapter that this question came from, and pay attention for when the ++ and += operations are first introduced.
With your second question you're basically trying to to figure out how many times the weeks went into the number of days. I believe this will come from the same chapter as problem one. This time pay attention for when the modulus "%" is introduced.
As for your third question, I don't understand what you're asking.
Honestly if you're having problems in your class b/c it seems to be going faster then you can keep up or if you're just not understanding it then it's MUCH better for you to go ask your teach for help then it is for you to ask other people for help doing the questions/projects. If you just ask us for help it'll come out in class that you don't know what you're doing and you'll bomb the class, however if you go to your teacher I'm sure they'll help you to do better and help explain stuff so that you can learn the stuff and do the work on your own. Trust me, even if you've been lying about doing your reading and getting stuff done it'd be MUCH better for you to come clean to your teacher then to continue to lie and worry about getting a D or F in the class
-
I agree with the rest that you shouldn't spam with your homework (or even ask us to do one problem) I'll help without giving the answer, though Just one for now:
How do I rewrite the following statement a two statements without usingcompund or increment operators
count += k++
Well...think. You can't use "+=" or "++". But what do these do? "x += a" is the same as saying "x = x + a." "x++" is the same as saying "x = x + 1." But what is the difference between "x++" and "++x," and how will this affect the answer? Put all of this together, and you should get it 
If you want to check your answer, assign count and k some value. Then run the code in your head. Then just do the same with your new code to see if everything comes out the same.
System specs:
| Core i5 750 | GA-P55A-UD3 | 4.0 GB G.skill DDR3 1600 | eVGA 470 GTX |
| Intel X25-M 80 GB SSD | WD 5000AAKS | Lian Li PC-7FN | Corsair TX750W |
| Windows 7 Home 64-bit |
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|