- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
14 Posted Topics
Re: [quote]Does this command exist in C?[/quote] I believe it's fflush(). I could be wrong, though. [quote]And is this the best way to read a line of input?[/quote] If all else fails, I do something similar to this: [code] while ((input = getche()) != '\n' && length <= max_length) { buffer[length] … | |
Re: You only make something const(constant) if it's , well, constant. If you're going to change anything about it, or any sorts of funky errors pop up, you're better off not const-ing it. I personally never use const, though I did take C first, so that might have something to do … | |
Re: Left could be done by going: [code] char left(char *string) { return string[0]; } [/code] Right could be done like this: [code] char right(char *string) { return string[strlen(string)]; } [/code] I'm no VB programmer, since it's my personal opinion that VB is for idiots, so I don't know what mid() … | |
Re: Let me get this straight: You want a program that will take a picture, and output a new picture with frames? If so, it should be fairly easy, I think. Just make a bitmap with a little space on each side of the original, and then use the Windows functions … | |
The other day, I got an idea for a compression program, and decided to write up a function that compresses a file into "filename.compressed". Compression function works fine, but I get a nasty assertion failure at the return of the main() function, after the file's been compressed. Assertion failure is … | |
Re: What do you mean 3 users using your program? You're only going to have 1 user to your program, unless it's internet based. If ya' mean 3 different inputs to teh program: [code] #include <stdio.h> #define users 3 int main(void) { printf("Input %d heights:",users); int loop = 0; double temp[users]; … | |
Re: Hmmm.... Well, instead of using DirectX 8.1, you should use DirectX 9. Did you replace the ddraw.h in DirectDraw 4 with the one for DirectDraw 9? I looked at my own DirectX game, and found this: IID_IDirectDraw7 Seeing as how it's case sensitive(or at least that's how my compiler works), … | |
(edit) Code was too long for forum. I'm splitting it in 1/2 I'm currently working on a Direct3D class that simplifies D3D, so I can use it to make games, applications, etc. I started on it yesterday, got it to work so it draw triangles with a different color on … | |
Re: How bout' something like this: [code] int length(char *string) { int blah = 0; char *pointer = string; while (*pointer++!=NULL) blah++; return blah; } [/code] Theoretically, that should give you the length of a string. Might not work since I thought it up right now. [quote]When I use sizeof(strString) I … | |
Re: Awright, I don't know what 'cs' is. But here's a basic idea of what you need to do: Get input and store in variables named 'width' and 'height' for (temp=0;temp<width;temp++) for (temp2=0;temp2<height;temp2++) print out '#' How it works is it goes across: ##### But since theres another for loop every … | |
Re: Well, if you want, I could cook up a console game, and you could learn from that. | |
Re: From my understanding of your post, it sounds like you want to get a 2D array of seats, add passengers, and sort em'. A 2D array will be done something like this: [code] bool **array = new bool*[width]; for (int temp=0;temp<width;temp++) array[temp] = new bool[height]; [/code] Thus, you have an … | |
Re: Your first program is too big. Something like: [code] #include <stdio.h> void Swap(int *first,int *second) { *first ^= second; *second ^= first; *first ^= second; } int main(void) { int numbers[4]; for (int temp = 0;temp<3;temp++) scanf("%d",&numbers[temp]); for (temp=0;temp<2;temp++) { if (numbers[temp] > numbers[temp+1] ) Swap(&numbers[temp],&numbers[temp+1]); } if (numbers[0] > … | |
Re: Do you know the position of the char? If so: char_array_name[position] = new_character; char_array_name is the name of the array. position is an integer value specifying the offset from the address of the start of the array. new_character is the character you want it to replace it with, like 'A'. … |
The End.