Remember my first program? Well, heres the sequel.
Printable View
Remember my first program? Well, heres the sequel.
A) What is the point of the post?
B) Why do you use define statements that are not needed?
C) Try taking the entire name as one string using getline. Therefore, the user doesn't have to hit enter twice.
*playing with his sleeves*
Huh? Ok, sure, whynot?
I ran an earlier version of this program and it worked to some extent, but the two biggest problems that I have with this program (aside from the complete lack of portability) is this:
First, redefining a common keyword just obfuscates the code, and hides spelling errors if you use an IDE that will make keywords a different color. When learning a language, use it correctly until you understand what rules you can bend and how to do so without creating new bugs. The second problem is that you make every member public in your class. If you don't care about data hiding then you might as well just use a struct and not pretend you're writing an object oriented program.Code:#define group class
group program_variables
{
public:
int mainresponse;
unsigned int age;
char name[25];
char lstname[25];
char gender[7];
char personality[25];
char hobby1[20], hobby2[20], hobby3[20];
void calculator();
void stalker();
void watch_loop();
};
-Prelude
:confused:
Yeah Jason, I said the same thing. I'm an intermediate in C++ so I know what I'm doing. The purpose of my posting my program is for you to enjoy the .exe file. If you want to correct my .cpp file e-mail me at [email protected]
My style of C++ coding is much different from you guys.
Could someone tell me what the Sleep() command does and it's syntax.....it seems quite interesting.
hey you're using STYC++ in 21 Days right? Because I see Frisky and Fout.....
>If you want to correct my .cpp file e-mail me
If you don't want comments on your code then post the .exe on the GD boards. These are discussion forums on programming, if you post code then people will discuss the code. As for emailing, don't expect it since one of the benefits of discussion is getting different persepctives as opposed to just one person offering suggestings in an email.
>Could someone tell me what the Sleep() command does and it's syntax
The sleep function is a function that simply causes a delay, the argument is the number of miliseconds that the delay will last.
-Prelude
oh cool so this would work............
int x;
x=125;
Sleep(x);
?
Yes
-Prelude
Sleep(x) is a great function. Is there another function like it?
Code:
Wake (NOW!!!);
Wake ( IN '5');
j/k I don't know :D......it is pretty cool.
uhh...I didn't laugh at that joke. Was that suppose to be funny? Was that some nerdy joke you guys do?
>Wake ( IN '5');
Or the equivalent macro
snooze();
But don't forget to include early.h
-Prelude
"I'm an intermediate in C++ so I know what I'm doing"
So why are you redefining simple keywords and declaring all items public in a class???
Ruflano, why are you making fun of echulo. If you are so "cool", you wouldn't be making programming groups. So don't bother making fun of people because it will just make u look dumb.
I agree, don't do this:
I wouldn't call that "style". I would call that uncessary and ridiculous. No offense or anything, but #define's are usually used for constant numbers, not for changing the look of the syntax of your program.Code:#define group class
group program_variables
{
public:
int mainresponse;
unsigned int age;
char name[25];
char lstname[25];
char gender[7];
char personality[25];
char hobby1[20], hobby2[20], hobby3[20];
void calculator();
void stalker();
void watch_loop();
};
> My style of C++ coding is much different from you guys.
Yes, yours is commonly called "wrong".
Don't be a dick to chulo. I thought his joke was pretty funny.
See how stupid this is/was? Mind you it compiles in VC++6, it isn't style nor is it practical or accepted.Code:#include <iostream.h>
#define PLEASE_PRINT_THIS cout
#define AN_INTEGER_NUMBER int
#define A_NUMBER_THAT_HAS_A_DECIMAL_POINT_THINGY double
#define ADD_THESE_PLEASE +
#define SUBTRACT_THESE_d00d -
#define THE_BEGINNING_OF_MY_l33t_PROGRAM int main()
#define GO_TO_THE_NEXT_LINE_MOFO endl
#define CAN_YOU_RETURN_ZERO_PRETTY_PLEASE return 0
THE_BEGINNING_OF_MY_l33t_PROGRAM
{
AN_INTEGER_NUMBER num = 5;
AN_INTEGER_NUMBER answer;
PLEASE_PRINT_THIS << "Yo d00d, I know what I'm doing" << GO_TO_THE_NEXT_LINE_MOFO;
num = num ADD_THESE_PLEASE 5;
answer = num SUBTRACT_THESE_d00d 10;
PLEASE_PRINT_THIS << (A_NUMBER_THAT_HAS_A_DECIMAL_POINT_THINGY)answer << GO_TO_THE_NEXT_LINE_MOFO;
CAN_YOU_RETURN_ZERO_PRETTY_PLEASE;
}
I went anonymous b/c I feel guilty for posting this but somebody had to :)
Hey that look like VB code
Hehe... In this old Atari-ST book I have, they have you write this header file with lines like
#define begin {
#define end }
#define then
so you can say
if (i == 2) then
begin
// ...
end
Dont forget snoozebtn() and its syntax snoozbtn("1:smash","2:throw out window")
:)