User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » my c++ homework (edited so no one can cheat) Page [1]  
evan
All American
27701 Posts
user info
edit post

i write the best comments/output ever.

i replaced a shit ton of the code with "(some code)" so no one can cheat/copy this shit. you know how csc is about that.



//----------------------------------------------------------------------
// Program Name: Zeller's Algorithm
// Assignment: Homework 4
// Date: 21/10/07
//
// Programmer: Evan Kinney Student ID: 000-795-299
// Course: CSC 114 - 601 Lecturer: Dulberg
//
//
// Program Description: Determines the day of the week for a specific date.
//
// Input: The month, day of the month, and the year.
//
// Output: The day of the week.
//
// Assumptions/Limitations: The user will enter only integers.
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//
// I can has iostream.h?
//
//----------------------------------------------------------------------

#include <iostream>

//----------------------------------------------------------------------
//
// Let's get some functions up in here.
//
//----------------------------------------------------------------------

int getDay();
// Effect:
// Prompt user for the date, return the date entered.


int getMonth();
// Effect:
// Prompt user for the date, return the month entered.


int getYear();
// Effect:
// Prompt user for the date, return the year entered.


int zeller(int theDay, int theMonth, int theYear);
// Input:
// theMonth, theDay and theYear are integer values of the date that
// you wish to get the day of week for
// Output:
// Returns the day of the week that cooresponds to the input (0=Sunday ... 6=Saturday)
// Effect:
// NONE- no output to the screen!!!!


void doStuff();
// Effect:
// Does all the work. Used to clean up the code.


void outDay(int theDayOfWeek);
// Input:
// theDayOfWeek, from 0..6.
// Output:
// The day of the week in chars.


bool goAgain();
// Effect:
// Asks if user wants to enter another number.


//-----------------------------------------------------------------
//
// We're starting the main program now, yo.
//
//-----------------------------------------------------------------


int main() {

doStuff();

while (goAgain()) { // do we want to doStuff again? hmmm?

doStuff();

}

// *wipes brow* yay, we are done!
return 0;
}

//-----------------------------------------------------------------

void doStuff() {

outDay(zeller(getDay(),getMonth(),getYear()));

}

//-----------------------------------------------------------------

int getDay() {

(some code)

} else {
cout << "\n\nDude - seriously - what are you doing? Enter a day between 1 and 31.\n";
doItAgain = 1;
}

(some code)
}

//-----------------------------------------------------------------

int getMonth() {

(some code)

} else {
cout << "\n\nNice try - why don't we try entering a month that exists?\n\n";
doItAgain = 1;
}

(some code)
}

//-----------------------------------------------------------------

int getYear() {

(some code)

} else {
cout << "\n\nHow about we enter a more recent year.. say, greater than 1582?\n\n";
doItAgain = 1;
}

(some code)
}

//-----------------------------------------------------------------

int zeller(int theDay, int theMonth, int theYear) {

(some code)

} else { // something else? mkay.

(some code)
}

//-----------------------------------------------------------------

void outDay(int theDayOfWeek) {

(some code)

(some code) (theDayOfWeek) { // okay, so what day are we dealing with here?

(some code)
}
}

//-----------------------------------------------------------------

bool goAgain() {

(some code)

} else {

cout << "\n\nOkay, you fail at life. I'm going to assume that you wanted to enter another number\nsince you can't seem to respond correctly.";
return true;

}

// we should never get here.

return true;
}

//----------------------------------------------------------------
//
// Ay yo, we done. Crank dat soulja boy.
//
//----------------------------------------------------------------

10/22/2007 1:35:57 AM

simonn
best gottfriend
28968 Posts
user info
edit post

for the most part, i like you evan.

but did you really just joke up your c++ hw and then post said jokes?

10/22/2007 1:38:37 AM

evan
All American
27701 Posts
user info
edit post

*sigh* i thought it was funny

oh well.

[failboat]

10/22/2007 1:40:46 AM

simonn
best gottfriend
28968 Posts
user info
edit post

i'm not saying it's not funny, but something like that is only funny when done subtly.

10/22/2007 1:42:22 AM

evan
All American
27701 Posts
user info
edit post

well this shit's boring enough as it is... i already know c++, i had to do SOMETHING to make it interesting, haha

10/22/2007 1:43:29 AM

Mindstorm
All American
15858 Posts
user info
edit post

Oh noes not CSC jokes...

10/22/2007 1:49:56 AM

H8R
wear sumthin tight
60155 Posts
user info
edit post

haha, i remember doing that same shit in java

gg

10/22/2007 1:52:03 AM

simonn
best gottfriend
28968 Posts
user info
edit post

^^^ by "done subtly" i meant "not posted on thewolfweb"

10/22/2007 1:55:02 AM

catalyst
All American
8704 Posts
user info
edit post

I wouldn't even post any of that shit online

CSC is fucking anti-cheating-sharing crazy

[Edited on October 22, 2007 at 2:14 AM. Reason : not that you're gonna get caught, but still]

10/22/2007 2:13:09 AM

moron
All American
34142 Posts
user info
edit post

printf > cout

10/22/2007 2:18:46 AM

WolfAce
All American
6458 Posts
user info
edit post

oh zeller

10/22/2007 1:35:29 PM

Oeuvre
All American
6651 Posts
user info
edit post

this is some elementary bullshit.

10/22/2007 1:36:47 PM

FykalJpn
All American
17209 Posts
user info
edit post

i built rube goldbergian java programs for shits and giggles in 216 back in the day--haha, fucking objects for everything

[Edited on October 22, 2007 at 1:42 PM. Reason : i'm sure the graders loved me]

10/22/2007 1:40:24 PM

Novicane
All American
15416 Posts
user info
edit post

// **********
// * { ^ ^ } *
// * ( __ ) *
// * MONKMONK!!!*

10/22/2007 1:40:24 PM

GraniteBalls
Aging fast
12262 Posts
user info
edit post

i used to do this.




for the really simple programs, i would make funny function names and integers.




professors don't like sexual innuendos when describing input/output to a function.

10/22/2007 1:48:56 PM

krazedgirl
All American
2578 Posts
user info
edit post

NERD POST OF THE YEAR

10/22/2007 1:50:00 PM

Chance
Suspended
4725 Posts
user info
edit post

If you already know c++, why are you in 114? Why not skip right to 116?

Also, I thought NCSU switched to Java for the intro courses, are they back to C++ or do they give the option?

10/22/2007 1:52:33 PM

DaveOT
All American
11945 Posts
user info
edit post

Lavim used to name things in his C++ code so you would have function calls like

suck(my->nuts);

10/22/2007 1:54:46 PM

philihp
All American
8349 Posts
user info
edit post

If you want your grader to cry, do things like use the ?: operator, or do something like Duff's Device and make him really think. Don't be intentionally misleading (like putting everything on one line, which is very newbie-ish).

Really elegant and simple solutions using a minimal amount of actual code that take a lot of brain power to understand are the best.

Take advantage of built-in parts of the language. Why use while(true), when for(;;) does the exact same thing?

Also, there's no reason an index to a for loop has to increase by a static, linear amount. There's also no reason why you can't put do-stuff-code inside the for parens. If you can find a situation where it would make sense to do this, do it.

int printDots(int j) {
for(int k=j; --k; ) printf(".");
return j-k;
}

int main() {
for(int i=0,j=0; i<256; i+=printDots(j));
return EXIT_SUCCESS;
}


[Edited on October 22, 2007 at 2:26 PM. Reason : .]

Oh, and another thing... ANSI C doesn't define the order that parameters in a function are executed. This can be another source of fun. The output of this program depends on the compiler's interpretation of the ANSI spec.

int printHello() {
printf("Hello, ");
return 0;
}
int printWorld() {
printf("World!\n");
return 0;
}
void doNothing(int x,int y) {
}
int main() {
doNothing(printHello(),printWorld());
return EXIT_SUCCESS;
}



[Edited on October 22, 2007 at 2:31 PM. Reason : .]

10/22/2007 2:18:14 PM

evan
All American
27701 Posts
user info
edit post

Quote :
" HWK_4 Comments
Good assignment, your comments are fun to read but try to avoid function names like doStuff(). While cool at the time, it sucks to try and maintain a 100,000+ line project when all the functions do not say what they do... try for descriptive names, instead."

10/29/2007 9:19:52 PM

zorthage
1+1=5
17148 Posts
user info
edit post

Quote :
"professors don't like sexual innuendos when describing input/output to a function."


sorry i missed this thread

10/29/2007 9:39:37 PM

abbradsh
All American
2418 Posts
user info
edit post

i saw csc and thought i smelled dirty indian

10/29/2007 9:50:11 PM

damosyangsta
Suspended
2940 Posts
user info
edit post

why did you name the read procedure "zeller();" ?

10/29/2007 9:53:50 PM

Lionheart
I'm Eggscellent
12775 Posts
user info
edit post

Quote :
"Really elegant and simple solutions using a minimal amount of actual code that take a lot little brain power to understand are the best."


fixed

10/29/2007 9:55:21 PM

ambrosia1231
eeeeeeeeeevil
76471 Posts
user info
edit post

I love this thread.

10/29/2007 10:58:08 PM

Madman
All American
3412 Posts
user info
edit post

you will get far by fucking with "the system"

10/29/2007 11:04:33 PM

pttyndal
WINGS!!!!!
35217 Posts
user info
edit post

He probably named it Zeller because it uses the Zeller algorithm- an equation used to determine what day of the week(Sun-Sat) a particular date of the year will be. God I hated making that fucking calendar crap in the lab for CSC 116.


[Edited on October 29, 2007 at 11:16 PM. Reason : ]

10/29/2007 11:12:49 PM

parsonsb
All American
13206 Posts
user info
edit post

yeah shittiest lab ever

err the whole of csc116 lab, not just this part though this was pretty bad

10/30/2007 12:26:13 AM

 Message Boards » Chit Chat » my c++ homework (edited so no one can cheat) Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.