949 Posted Topics

Member Avatar for firoz3321

For me, the above just won't do. I couldn't care less about the "annoying" aspect of the output! ***WHAT*** is the problem that has you stumped --- EXACTLY. What is your input - how many words do you need to handle. What is your output - what's wrong with it …

Member Avatar for Adak
0
3K
Member Avatar for vijaysrivatsa

The for loop restricts the number of students being assigned marks. It could restrict it to 0, or to 20000, (or more), depending on what the user input as his/her choice.

Member Avatar for Adak
0
136
Member Avatar for poornimashobana

One example: [CODE] #include <stdio.h> int main() { int i, n ; double d = 0.0; d = 3.33 * 3; n = d; printf("\n N=%d D=%lf", n, d); printf("\n\n\t\t\t press enter when ready"); i = getchar(); ++i; return 0; } [/CODE] Note how anything after the decimal point is …

Member Avatar for poornimashobana
0
72
Member Avatar for pawan_sharma777

You pretty much have it: [CODE] char array[]= {"Lara","Lin","Nitin","Krishna","Sophia"}; [/CODE] If you want the names on their own row, then add another dimension to the array: char array[5][] = { {"Lara"}, {"Lin"}, etc.

Member Avatar for pawan_sharma777
0
99
Member Avatar for iqra123
Member Avatar for adi.shoukat

Turbo C is smart about how it handles this - it won't just move one int at a time. I use ver. 1.01 of TC, and I get an error on main() without a return int, but it will allow void main() with no return. Can you use an int …

Member Avatar for Adak
0
2K
Member Avatar for nosson

[CODE] j=-1; for (i=0; i<size; i++) { if (counter % row == 0) { j++; } pmatrix[i]=pmatrix[i]/ratio[j]; printf("pmatrix %d after ratio: %f \n",i,pmatrix[i]); counter++; } [/CODE] In the if(counter % row == 0) line, are you aware that when i== 0 (first time into the loop), that the statement will …

Member Avatar for WaltP
0
171
Member Avatar for dapcigar

Yes, we can help, but I see no program to help. We help - we do not *do* the homework for you.

Member Avatar for Adak
0
335
Member Avatar for rampraveen

I can't get it to work, but I can see that it's close. This is with the C compiler in Turbo C/C++ ver. 1.01. This uses direct video writing, and oddly, direct video writing still works with Windows XP (32 bit), as the operating system. That's for certain! But I …

Member Avatar for Adak
0
146
Member Avatar for archana.c07

[QUOTE] the hex value 00 00 00 00 00 BC 61 4E (LSB) which is stored in string as char data[8] = {0x4E, 0x61, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00}; [/QUOTE] It looks like the char bits need to be swapped, front to back. Is that right? An endian switcheroo. …

Member Avatar for Software guy
0
261
Member Avatar for mamashi

If you don't want question marks messing up your numbers, why put them in char *foo? Your logic and English both leave me with question marks. ;)

Member Avatar for abhimanipal
0
147
Member Avatar for SHENGTON

This is Selection sort: [CODE] for(i=0;i<n-1;i++) //OK { for(j=i-1;j>n;j++) //j=i+1 { if(a[i]<t) //if(a[i] > a[j] { t=a[i]; a[i]=a[j]; a[i]=t; } } a[i]=t; //delete this line entirely } [/CODE] j=i+i is because i<n-1, see? There's always room for j one more than i. Selection sort is a good sort to memorize, …

Member Avatar for Adak
0
133
Member Avatar for aianne

I gave you [B]explicit[/B] instructions on how to get started in graphics mode, but you've ignored them, and just now you're posting up some half-baked lines of code with no logic in them, as a "clue". And they're not even from you! My first "clue" is that you won't have …

Member Avatar for jhamelberja@yah
-3
157
Member Avatar for vovasquez

First, always highlight your code and click on the [CODE ] icon at the top of the editor. That will put your code into a special font, etc., so it becomes easily readable. Second, inside your while loop (which looks good by the way), you need to have some variables and …

Member Avatar for abhimanipal
0
102
Member Avatar for anjoz

It's dicey to overwrite data in a file - any error, even a disk error, can ruin the entire file, until the file is rebuilt. That is a time consuming process, which may not fix all the data, anyway. So what to do? Most programs do it this way: When …

Member Avatar for Adak
0
84
Member Avatar for jeevsmyd

[QUOTE=jeevsmyd;1269929]use of a string did solve the telephone number problem and use of gets resolved the space issue.. but I still dont know what is wrong with the use of clrscr() .. How do I clear the screen before the other question is asked? is there any other way so …

Member Avatar for Adak
0
113
Member Avatar for jmangu

If you're using conio.h, you have no need for curses, and vice-versa. Decide which library you like (conio.h) <cough, cough>, and forget the other. ;)

Member Avatar for Ancient Dragon
0
443
Member Avatar for Shikhin

I wouldn't go that way with your logic. Don't use ascii numbers for your letters, unless you really need to. Use char's for letters, and stick with 'A', 'B', etc., instead - much easier to read and intuitively understand. A couple things to get figured out: 1) You need to …

Member Avatar for Shikhin
0
178
Member Avatar for Bips123

Welcome to the forum, Sumanawal. :) More details are needed. You can't put a graphics image into a console (text) window, but you can adjust the background and text colors, in a console window. Are you trying to work with a graphics window, or a console window?

Member Avatar for Adak
0
76
Member Avatar for NeishaB

Get to know the problem - really analyze it, in this case, by doing it by hand with paper and pencil. After you get the steps down into small steps which you can readily identify, then write down those steps -- That's your pseudo code. Check your pseudo code, that …

Member Avatar for NeishaB
0
119
Member Avatar for fussballer

What is the upper range of USHORT on your system? (check limits.h, etc.) Could you be overflowing the upper limit of it, or of the CD drive?

Member Avatar for wisaacs
0
521
Member Avatar for genie0582

TIME is not a variable, TIME is being replaced by the pre-processor, by the digit 5. So the compiler never see's TIME, and knows nothing about it. You see the results of this 1) because the program is correct and 2) because the program will compile.

Member Avatar for Adak
0
106
Member Avatar for morelve

This is a bit of code showing how to move the cursor, using one API, in the console window. [CODE] //you need to include <windows.h> void Gotoxy(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } void function Where I want to move the …

Member Avatar for Adak
0
3K
Member Avatar for anjoz

If you use scanf(), you have to know what scanf() does and does not do: 1) For char input, scanf() will take *ONE and one ONLY* char. That means that the newline char from hitting the enter key, is still in the keyboard buffer. Which means that the NEXT scanf() …

Member Avatar for Adak
0
2K
Member Avatar for ranjita.cdt.esg

I strongly suggest you take this subject up with forums or *newsgroups* that specializes in computer editing of images. You've moved away from C programming, and you need to follow that. Come back if you have a C question or problem.

Member Avatar for 0x69
0
1K
Member Avatar for god_like

I see these problems with your program: 1) non-bomb squares adjacent to your chosen square, don't "avalanche" open. 2) you can't mark a square as a bomb, like you can in Minesweeper 3) the game doesn't end when the last free square has been chosen. It should be congratulating me …

Member Avatar for god_like
0
128
Member Avatar for Ferny84

The same way you know when a line ends - it finds the '\n' (newline) char. fgets() will have problems if the text is long, and has no newlines in it. That's odd, but I have seen text like that before.

Member Avatar for Ancient Dragon
0
119
Member Avatar for deeer

Take each function, make a note of: 1) What the function does correctly and 2) What the function does not do correctly That's the first step to debugging your program, and that's what anyone who wants to help might need to do, right off. This will help save them a …

Member Avatar for deeer
0
148
Member Avatar for aianne

A great deal of what you want is included in Turbo C's help files. After starting up the IDE (the editor inside Turbo C), click on "Help" on the far right hand side, and then on "Index". One graphic function that you will certainly want to look at is "rectangle" …

Member Avatar for Adak
0
313
Member Avatar for aliyami90

Use fgets in a while loop. When fgets() returns NULL, then you have reached the end of the text file. Aha! Inside that while loop, fgets() will put each line into your char array, which must be large enough to fit all the names into for ONE line. (for even …

Member Avatar for Adak
0
86
Member Avatar for fussballer

You need to address these questions to the manufacturer's web site. Another idea would be to try asking on a forum for CD software, like ImgBurn. You may need to ask several times before you get an answer, so don't be afraid to shop around. It's impossible to know how …

Member Avatar for rajeevpareek
0
272
Member Avatar for hasbeenbad

I would change "relation" to "verb" and use fgets() to put each line of the file, into a char buffer[] array. Then take all the char's from the first up to the first question mark, and copy that into your subject member. Then take everything from that point, until the …

Member Avatar for Adak
0
1K
Member Avatar for sanagopi

If it's a binary number (don't let the hexadecimal value mislead you, i is still just a binary number, internally), and you moved the one's in that binary number, two columns to the left (filling up behind it with zero's). What would you have? We know that 0xff is 16 …

Member Avatar for Banfa
0
2K
Member Avatar for rttrade99

No, they're different languages, but Objective C can run C code, since it is a superset of C. Read all about it, on Wikipedia: [url]http://en.wikipedia.org/wiki/Objective-C[/url]

Member Avatar for Adak
0
76
Member Avatar for sanagopi

You should have a doubt, because if your compiler will run the code, it will give you a NULL pointer assignment error, right at the end. At least, that's what I got. This kind of "fun and games with freakish C syntax ", is a total waste of time, and …

Member Avatar for Adak
0
90
Member Avatar for iwanttolearnc

ADHR should be, by convention, a defined global variable or constant, (thus the all caps). First that value (defines in C are a straight substitution) is left shifted two places, then the result is cast as an integer. Finally that value is returned from the function.

Member Avatar for iwanttolearnc
0
101
Member Avatar for Ferny84

Malloc() is part of stdlib.h, which you did not include. You would have received an error, except you cast the return from malloc(), so it didn't give you one. In addition to the above advice, you need to include stdlib.h in your header list, and in C, there is little …

Member Avatar for Ferny84
0
135
Member Avatar for newcoder777

You need to look at your hardware for such small timing intervals, not software. Are you using a 555 timer IC chip? What timer features does your PIC chip offer? That's where you need to look - C that uses your hardware, rather than your OS.

Member Avatar for newcoder777
0
287
Member Avatar for yasemin

A nice way to do this is to put each line of text, into a char buffer[] array, say about 10 char's larger than any line in the text. (roughly). Then you can use the simpler index of the buffer[] array, to move around as you'd like, and string to …

Member Avatar for abhimanipal
0
131
Member Avatar for tdk420n

You can use strstr() to find a sub-string (word), within a string. In your case though, you just need to find line[0] == 'F', and that's your line. :) I would go as far as testing it a bit further, though: [CODE]if((line[0]=='F') && (line[1]=='r') && (line[2]=='o') && line[3]=='m') { //rest …

Member Avatar for tdk420n
0
194
Member Avatar for notdoppler

Would you post up a small sample of the input file, which is giving you this problem. I'm having trouble visualizing what the problem could be.

Member Avatar for abhimanipal
0
286
Member Avatar for gameon

Please post up a little snippet of code trying to do what you want, and let's see what the problem is.

Member Avatar for Aia
0
193
Member Avatar for Silen

It may not be guaranteed to be portable by the C standard, but I've never heard of a C compiler that doesn't have signed and unsigned char's. I'm sure there's some minimalist one that is that way, but it's designed for embedded applications, I'd bet $$$.

Member Avatar for Silen
0
133
Member Avatar for Iam3R

You don't want to over-write records and shuffle them around a lot - that's risky business, and unnecessary. Instead, just mark the name or a record number (like an id number with students), as zero or '\0'. Now, your program can tell that record has been deleted, and is available …

Member Avatar for Adak
0
1K
Member Avatar for MrDiaz
Member Avatar for MrDiaz
0
126
Member Avatar for tenix

Are you trying to dynamically size the array with malloc or calloc? "something happened here" is a complete mystery to me.

Member Avatar for tenix
0
16K
Member Avatar for Freespider
Member Avatar for abhimanipal
0
109
Member Avatar for harshchandra
Member Avatar for hassall

If you have Windows XP 32 bit, you will be able to run the Turbo C programs and IDE, on it. If you have the 64 bit version of Windows XP, then I don't believe you can run Turbo C, because it's 16 bit software. You could perhaps use something …

Member Avatar for hassall
0
212
Member Avatar for Xufyan

you're using i as the iterator for both of the nested for loops! ;) And why are using two loop for this? You only have 2 elements in your array to fill up. Can't you get rid of the inner for loop?

Member Avatar for MageBane
0
248

The End.