|
Nice, but the following is worse, way, way , way worse. Its valid c/c++ code
??=define _i_ int
??=define _i (??/
_i_
??=include<stdio.h>
_i_ main ??/
_i ??/
__i, char* ??/
i_??/
??(??/
??))
??=define _endl_ ;
??<char _s??/
??(9??/
??), _i__??/
??(4??/
??) _endl_
??=define _s_ _endl_ _s
??<_s_ ??/
??(0??/
??) = '??/
??=' _s_ ??/
??(1??/
??) = '??/
??(' _s_ ??/
??(2??/
??) = '??/
??/??/' _endl_
??=define _m_(m_) ? m_ :
??>_s_ ??/
??(3??/
??) = '??/
??)' _s_ ??/
??(4??/
??) = '??/
??'' _s_ ??/
??(5??/
??) = '??<' _endl_
??=define _START(s) for _i __i__ = s _endl_
??<_i_ e = (__i == 2) ? (((*i_??/
??(1??/
??)-0x30) < 0) ??/
??!??/
??! ((*i_??/
??(1??/
??)-0x30) > 9)) _m_(9) (*i_??/
??(1??/
??)-0x30): 9 _endl_
??=define _VALIDATE(v) __i__ < e _endl_ __i__++)
??<_s_ ??/
??(6??/
??) = '??/
??!' _s_ ??/
??(7??/
??) = '??/
??>' _s_ ??/
??(8??/
??) = '??-' _endl_
??>
??=define move_to(n) case n:
??<_START(0) _VALIDATE(0)
??=define skip ) _endl_ break _endl_
??<switch (__i__)
??< move_to(0)
??=define to_mem sprintf (_i__,
??<to_mem "??/
???/?=" skip
??> move_to(1)
??=define _do_i_ "%d. "
??< to_mem "??/
???/?(" skip
??>move_to(2)
??< to_mem "??/
???/?/" skip
??> move_to(3)
??< to_mem "??/
???/?)" skip
??=define move_screen printf (
??=define show_single(i) , _s ??/
??(i??/
??)
??=define _char_ " %c"
??>move_to(4)
??< to_mem "??/
???/?'" skip
??> move_to(5)
??< to_mem "??/
???/?<" skip
??=define _endl_null_ return 0 _endl_
??>move_to(6)
??< to_mem "??/
???/?!" skip
??> move_to(7)
??< to_mem "??/
???/?>" skip
??=define _text_ " %s means "
??>move_to(8)
??< to_mem "??/
???/?-" skip ??>
??>move_screen _do_i_ "_text_"_text_"_char_"_char_"??/
??/n", __i__, _i__ show_single (__i__)) _endl_
??>
??>
??> _endl_null_
??>
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
|
What did I do wrong
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
BadKarma wrote: What did I do wrong
I was talking about those tri/digraphs or whatever they call them (so 80's!)
|
|
|
|
|
Now that is some _ugly_ code!
|
|
|
|
|
wow, You ca really **** up your code with C++...
|
|
|
|
|
are you goin to 80s??? i am really goin to mad!!!
Truth Can'nt be changed
|
|
|
|
|
Sweet. Of course, feature creep will getcha with this one.
|
|
|
|
|
Wow, talk about obfuscating the code!
|
|
|
|
|
Psuedocode in realcode! Sweet!
Chuck Norris has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO. In the movie "The Matrix", Chuck Norris is the Matrix. If you pay close attention in the green "falling code" scenes, you can make out the faint texture of his beard. Chuck Norris actually owns IBM. It was an extremely hostile takeover.
|
|
|
|
|
Reminds me of a certain guy
|
|
|
|
|
Someone who always says "please", "dear" and "best regards"? Reminds me of pretty much all of the people I work with.
|
|
|
|
|
(message found on a sharing file web site)
"Download in NaN seconds"
mmhh... maybe I try to download it tomorrow.
I'm sorry that I have not the code, but you can try to guess it.
Tommy
|
|
|
|
|
At least it doesn't produce an error or crash when trying to parse what's NaN...
|
|
|
|
|
Dealing with time produces funny horros, like the following one
(found when I was in my former company):
TotalSeconds = GetTotalSeconds();
Seconds = 0;
Minutes = 0;
Hours = 0;
for (i=0; i<TotalSeconds; i++)
{
Seconds++;
if ( Seconds == 60)
{
Seconds = 0;
Minutes++;
if (Minutes == 60)
{
Minutes = 0;
Hours++:
}
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote:
<code>long TotalMilliSeconds = gettime();
for (i=0; i<Total<code>Milli</code>Seconds; i++)
{
<code>MilliSeconds++;</code>
<code>if (MilliSeconds == 1000)</code>
<code>{</code>
<code>MilliSeconds = 0;</code>
Seconds++;
if ( Seconds == 60)
{
Seconds = 0;
Minutes++;
if (Minutes == 60)
{
Minutes = 0;
Hours++:
}
}
}
}
Ooo, I like that. Did your company receive a bug report about that "clock application" they wrote (I added the relevant code above in Red )?
SPR: #8327
PROBLEM DESCRIPTION: My clock application takes 100% CPU and doesn't update every second.
LIKELY CAUSE: long timespan = gettime(); // number of milliseconds since September 1st, 1970.
SOLUTION:
Your clock is running through 1,199,836,800,000 (1.2 trillion) iterations per second, you dumba**.
|
|
|
|
|
Sad to say (I don't like to shoot to the red cross) the authors came from VB world.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, that would work, but it sure is the slow way of doing it
Bill W
|
|
|
|
|
Indeed it is working. The horror application is still alive.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I understand that not everyone can be an expert at higher math, but that is really bad.
Bill W
|
|
|
|
|
It's so fast, the time is Not even a Number!
(reminds me of that _other_ guy...)
|
|
|
|
|
I. Overview
1. Create a program that will accept the necessary inputs and generate the proper outputs based on the processing instructions.
2. The program should meet all the requirements.
II. Inputs
1. Employee’s ID Number – an 8 digit integer
1st four digits signifies the year the employee started.
5th digit signifies employment type. 0 for regular, 1 for
contract. Other values are invalid.
Last 3 digits are irrelevant for this program.
2. Salary Grade – a real number
3. Days worked for the month – an integer with valid values of 1 to 31 only.
4. wBonus – a character to signify whether the employee will receive a bonus or not
III. Processing
1. Prompt for all necessary inputs. Check every input for validity.
2. Compute for the employee’s salary for the month.
Basic Salary = Salary grade * Days Worked
For employees with bonus
For regular employees who started before 1990
Bonus = Basic Salary * .4
For regular employees who started before 2000
Bonus = Basic Salary * .3
For regular employees who started before 2006
Bonus = Basic Salary * .2
For regular employees who started after 2005 and contract employees
Bonus = Basic Salary * .1
Salary for the Month = Basic Salary + Bonus
3. Accumulate Total Basic Salary and Total Bonus.
4. Display Employee’s Salary for the Month(output #1)
5. Prompt if the user wants to process another employee. If yes, go back to #1.
6. Display Total Basic Salary and Total Bonus(output #2)
IV. Outputs (use 2 decimal places for real numbers)
1. ID Number and Salary for the Month. Example:
ID Number: 19970123 Salary: P1500.50
2. Total Basic Salary and Total Bonus. Example:
Tot Basic Salary: P180,000.90 Tot Bonus: P20,000.55
V. Requirements
1. Use the printf function for all outputs including prompts.
2. Use the scanf function for accepting/reading all inputs.
3. Use defined constants for the constants used in the bonus computation.
4. Declare/define functions for each routine/subroutine in the program.
5. Use error checking. If the user inputs an invalid value, inform the user and prompt for a new value.
6. Users should be able to use the program without special instructions or training.
bleh
|
|
|
|
|
|
Do your own homework
This forum is for sharing coding horrors that you have found on the job. Usually it winds up being when one finds work done by someone else that was done in a substandard manner.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Do your own f*cking homework.
Blog link to be reinstated at a later date.
|
|
|
|