-
actually the project is due 2 weeks from now, and i am trying to learn this stuff as fast as i can, i don't want the entire solution to a problem, i just came to this forum to get tidbits of help to help me over things that i can't find in my books or online anywhere else, i know noone else that does C++ code, so i figured i would come here and get some help. and if i don't come to you guys with homework questions, then what other types of questions are there?? if i'm in at my job doing programming, i'm not gonna need anyone else's help. anyways, thanks alot for the help, and "prelude", thanks for tryin, but that code is WAY over my head right now... and to you "sean mackrory", eat a xanax and chill out brotha...
-
djz3r0 - you're assuming the numbers are entered in ascending order. This will rarely be the case.
-
>good old fashoned c code
Maybe old fashioned, but certainly not good.
>void main(void)
Don't make me switch to ANSI nazi mode. main returns int, it always has.
>char char1,char2,char3,cahr4;
Check your spelling, or write enough C code so that you're physically unable to misspell char. ;)
>scanf("%c%c%c%c",char1,char2,char3,char4);
Eew. I say again, eew. First and foremost you need to use the ampersand in all of those charN's because scanf expects a pointer. Second, you need to check the return value of scanf because users can't follow directions (especially since you didn't give any in this program).
>printf("%c%c%c%c",char4,char3,char2,char1);
Okay, this is assuming that the characters are entered in ascending sorted order to begin with. I don't recall the OP mentioning that particular requirement. In fact, I can remember a specific example that suggests that the digits will be in random order, so your code is broken even if you fix it. :rolleyes:
-
alright, well thanks for the help i guess, "prelude", your dorkness far exceeds mine, and i mean that as a compliment, lol... i can't understand any of that code, yet, but alot of the other users have helped, thanks alot guys, i appreciate it :D
-
>"prelude", your dorkness far exceeds mine, and i mean that as a compliment
I'll take it as a compliment. ;)
>i can't understand any of that code
That was the point really. We're glad to help with your C++ problems, provided you can prove that you've given it an honest attempt. If you have an idea of how to go about it, run it by us and we'll offer suggestions. But a request for code that solves your problem doesn't go over well, and you'll either get stoney silence, flames, or extreme sarcasm for your trouble.
-
Hint:
Read the number as a char array. That gets it into a form that will make it easy to sort. And if you don't know how to use arrays (as your earlier post demonstrates), I suggest you read up on them (there's a tutorial on this site).
**EDIT**
Sorry Vicious, should've read the rest of the thread more carefully.