|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
... just kiddin'
![]() Hi there. I am a newbie and I have been learning C for the past, um, day. So please don't laugh at my simplistic problems. Or at least keep your laughs to yourself. A quick intro on me: my only previous knowledge of programming is playing about with QBASIC when I was 12 or 13, and the furthest I ever bothered to learn was 'if...then...else' statements. So you can imagine that the programs I created didn't really do much at all. I have been using Clickteam programs for years and you can see my game creations at my website: URL But Multimedia Fusion Express (the clickteam program I used) simplified many things so coding was less painful. I have learned a lot from it, which I might apply to C later on. I also know HTML like the back of my hand, but that doesn't qualify as a programming language. I don't code HTML by hand anymore, using GoLive is much quicker ![]() I have been reading the C tutorial at Howstuffworks (URL). I have gone through the first four pages relatively smoothly, and I have use the GCC compiler and 'Advanced Editor' on Linux (Mandrake, KDE). I have just installed C++Builder (version1) onto Windows from an old PC Plus cover CD. However, on the array page, the tutorial has gone into complications and not really explained them in a way I can understand. The program below is creates 'random' numbers, displays them, sorts them by value and then displays that. To be perfectly honest, it just scares me! I've tried to break it down to see how it works, but I still don't understand it. #include <stdio.h> #define MAX 10 int a[MAX]; int rand_seed=10; /* from K&R - returns random number between 0 and 32767.*/ int rand() { rand_seed = rand_seed * 1103515245 +12345; return (unsigned int)(rand_seed / 65536) % 32768; } int main() { int i,t,x,y; /* fill array */ for (i=0; i < MAX; i++) { a[i]=rand(); printf("%d\n",a[i]); } /* bubble sort the array */ for (x=0; x < MAX-1; x++) for (y=0; y < MAX-x-1; y++) if (a[y] > a[y+1]) { t=a[y]; a[y]=a[y+1]; a[y+1]=t; } /* print sorted array */ printf("--------------------\n"); for (i=0; i < MAX; i++) printf("%d\n",a[i]); return 0; } Anyone know how the hell this works? Heh... another question. Is there a way to get console apps in C++builder to stay open when they are finished instead of terminating, without having to put a while loop at the end? If not, I'll probably do back to GCC, but builder does makes compiling quicker and easier... |
|
#2
|
|||
|
|||
|
WAIT!!! I've figured it out!!!!!!!!! WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO! I never thought that solving programming puzzles could be so rewarding!!!!! It's just so simple when you understand it!!!!!!
![]() |
|
#3
|
|||
|
|||
|
DO NOT POST crabs like this here again because:
1) Off topic because there's C/C++ forum 2) When you figured out something, you need to tell us step by step how you did it. By saying I've figured it out!! without further details, you should just keep that to yourself rather than posting here, because it tells readers nothing but indicating that you are trying to show off to readers. |
|
#4
|
|||
|
|||
|
I'm sorry.
I posted it here because I thought the C/C++ forum would be for advanced users. I havn't used devshed before, so I don't know how you do things here. With 'dev' in the name, I assumed that this forum was programming related. I could post a reply saying how it works, but since I was the person who wanted to know in the first place, I did not bother to. I posted that, ahem, histerical message to let people know I didn't need a reply. Maybe it was that stupid title I used that annoyed you... |
|
#5
|
|||
|
|||
|
>> I thought the C/C++ forum would be for advanced users
There is no such rule. If you have a PHP question regardless how simple it is, you are more than welcome to ask only in PHP forum. Beginners forum is NOT a catch-all forum. It actually is a useless forum because here in Devshed there are plenty of forums for you to post to. |
|
#6
|
|||
|
|||
|
freebsd
freebsd: There is no need to rip someone's head off for the correct assertion that he wouldn't have got an answer on the C/C++ forum.
|
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > For just £2 a month you can help newbies program code for themselves. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|