949 Posted Topics

Member Avatar for milind123

Oscillator, *now* tell us how you [B][COLOR="Red"]really feel[/COLOR][/B] about this thread, won't you? ;) ;)

Member Avatar for jephthah
-5
128
Member Avatar for Aurorian

The getchar()'s are there to pull newlines off the keyboard buffer. In this case, since the program is scanf()'ing for numbers, the getchar()'s are not needed. Scanf() will jump over a newline, if it is looking for a number. Money should not be an integer, when the user enters it. …

Member Avatar for Aurorian
0
200
Member Avatar for Aurorian

Aurorian, here's an important idea to remember about floats and doubles: they can't perfectly represent every number. Integers can represent every (whole) number, but non-integer data types can't. They'll be *very* close, but not quite perfect. So making comparisons of float1 == float2 type, are a bad idea, overall. You …

Member Avatar for Murtan
0
98
Member Avatar for Tango2010

This is a lot of information that although old, is still used by Windows (up to XP that I'm sure of). Also, there is a short example program, using findfirst and findnext. /* This is from Turbo C/C++ (the C compiler), ver. 1.01 Help findfirst: Searches a disk directory. findnext: …

Member Avatar for Salem
0
665
Member Avatar for logicalguy

Change the return from your compare function to: [CODE] return(*(int*)a->id - *(int*)b->id); [/CODE] And it works fine. Nice program, btw. That GD casting on the return from the compare function, is one reason I dislike C's qsort. Sure, it's nice for different kinds of data, but damn it, people sort …

Member Avatar for Dave Sinkula
0
5K
Member Avatar for iNach

You need to assign the address that fopen() returns to your FILE * (pointer). [CODE]FILE *fp; fp = fopen("Keywords.txt", "rt"); if(fp == NULL) { printf("\nError opening file\n"); return 0; }[/CODE]

Member Avatar for Salem
0
136
Member Avatar for shubhabrata

Welcome to the forum, Shubh. :) A few important suggestions for you: 1) For your problem, start a new thread. Using someone else's is called "thread hijacking", and will get people upset with you. More people will see your thread when you start a new one, and respond. 2) When …

Member Avatar for Adak
-1
153
Member Avatar for japheth 2010

What we require, is that you take a stab at doing this assignment, and post up your code. Tell us where you're stuck. We can help, and the fact that it's Turbo C will not be a problem. I use an early version of it, myself. (The C side of …

Member Avatar for Adak
-2
89
Member Avatar for johndoe444

Your fscanf() line of code doesn't have a format specifier: [code] while ((fscanf(fp, " %s[^\n]", line) != EOF)) [/code]

Member Avatar for Adak
0
185
Member Avatar for hamilton168

The newptr should be sized for a pointer, so add an asterisk to this line: [code] newPtr = (struct Stack *) malloc(sizeof (struct Stack)); and make it: newPtr = (struct Stack *) malloc(sizeof (struct Stack*)); //don't you want to connect the rows, with it's columns? for(i = 0; i < …

Member Avatar for Adak
0
150
Member Avatar for Agello

Please post up your most recent code. I know you've made some changes, and I'm late joining this thread.

Member Avatar for Agello
0
262
Member Avatar for xavier666

[QUOTE=xavier666;1143873]Only for merge sort. The rest of the algorithms do not need a temporary array. By the way, Happy Holi![/QUOTE] Radix sort will require an auxiliary array, as well. What I've done for my AllSorts program, is have the second array made equal to the size of the original array. …

Member Avatar for xavier666
0
4K
Member Avatar for maria1110

When you are fscanf()'ing a char array, you need to just have the name of the array - that IS a const pointer to the base of the array. You need to remove the '&' in front of the char arrays that you will be scanning: [CODE] while (!feof(fp)){ fscanf(fp,"%d\n …

Member Avatar for Adak
-1
212
Member Avatar for zabr

I doubt very much if he has a lot of choices right now (after the school year has started), in what compiler the class is using, or what college to attend based on the compiler being used. Turbo C is no problem, but it sounds like you need to use …

Member Avatar for Aia
0
127
Member Avatar for me_roy

Is this what you're looking to do? [code=C] colMin = array[0][0]; colMax = array[0][0]; for (col = 0; col < MaxCol; col++) { for(row = 0; row < MaxRow; row++) { if(colMin) > array[row][col] colMin = array[row][col]; //and repeat above if statement for colMax } } [/code]

Member Avatar for WaltP
0
435
Member Avatar for the reaper

[QUOTE=the reaper;662576]i am sorry guys..i really don't know maybe because i have about 1 months of experiance in "c"...i will be on the lookout for all of your help...(I gotta admit it you are better then me when it comes to programming)..[/QUOTE] Then I would *hope* that we are better …

Member Avatar for WaltP
0
260
Member Avatar for vijaysoft1

Your url takes us to Free Image Hosting, but not to your picture/image. :( You have a large sorted list, and a binary search would be excellent. You'll need a few little tweaks to it: 1) If the person types a 'b', you change that to 'b ', (b + …

Member Avatar for Prabakar
0
271
Member Avatar for makubexiii

Basic error in your logic. You can't say for sure that the game is not over NOW, (after the opponent or yourself, has made a move), unless you check, first. I use a function named IsWin(), but the name is not important. You must include logic to check if the …

Member Avatar for makubexiii
0
114
Member Avatar for acchao

[QUOTE=acchao;655634]Let's see if I can try to explain myself better with this small test code: [code=C] #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int test_num = 216; int test_num2; char test_string[10]; FILE *fp_asciiHeim, *fp_converted; //create a read/write dummy file if((fp_converted = fopen( "data01.txt", "w+" ))==NULL) { printf("cannot open …

Member Avatar for Adak
0
240
Member Avatar for William Hemsworth

I'm not familiar with C++, but a few points on prime numbers: If no divisor is found w/o remainder less than or equal to the value of the square root of the number, then the number is prime. This really speeds up your testing. Numbers which divide evenly by 2,3,5, …

Member Avatar for Prabakar
0
159
Member Avatar for rob_xx17

I want to heartily second Vernon's post - not only is it a great trick for your problem, but it can be used for many others, as well. It's usually called Distributed Counting or Bucketsort, but you don't hear much about it, for some unknown reason. It has several advantages: …

Member Avatar for ArkM
0
116
Member Avatar for sasikala123
Member Avatar for raja289

No, I'm not going to try and run your code to find out what the problem(s) may be. I'm going to wait for you to tell me what *specific* problem(s) you have found with the program. [COLOR="Red"][B]It is your program, after all, not mine.[/B][/COLOR] Is the input wrong? What's wrong …

Member Avatar for raja289
0
411
Member Avatar for SwiftDeath

Is this right? (Line 75 or so) [code=C] if (element > element [left+1]) //??? { temp = element[left+1]; element[left+1] = element; //??? element = temp; //??? } [/code] element is the *address* of the array, a pointer to the array, and it's being compared with a value of the array?? …

Member Avatar for dwks
0
149
Member Avatar for hoticejin21

[QUOTE=hoticejin21;650600]guyz im having hard time of making a program that could run like a simple ATM machine using turbo c(using conditional statement and looping)... I can't think will coz the dealine of submission is on next week... could you gave an idea of that program.. pls??? i will just change …

Member Avatar for Adak
0
173
Member Avatar for vijaysoft1

I believe there are 2 sub cases when the user presses Enter: 1) If the cursor position is above (less than) the bottom row of the current screen (usually 25, but may be 43 or 50), then the cursor just moves to the next row down, and to the first …

Member Avatar for Adak
0
121
Member Avatar for flecture

[QUOTE=flecture;641986]hi cld anybody explain me the concepts of continue,break,return statement with an example using c program[/QUOTE] Sure. Then we could write your text book, your website tutorial, take your tests, etc. I don't mean to be harsh, but we're not Google, we're not auditioning to be your tutor, and we're …

Member Avatar for Ancient Dragon
0
247
Member Avatar for sinkingships7

This line of code is correct: [code=C] index_s1 = strlen(num_s1) - 1; [/code] Without the " - 1" in there, you are going outside the bounds of the array. Arrays are zero based, so if the array has 12 elements, and you access array[12], of a char array, you will …

Member Avatar for sinkingships7
0
121
Member Avatar for kv79

Just system("sample"); in a loop, will do. You may need to add a sleep(# of seconds) statement, before the next loop, so your bat file will have time to run, before the next call to run it. Do you know if the commands inside the sample.bat file will actually send …

Member Avatar for Narue
0
120
Member Avatar for Anbuvengeance

Line 571 has this code: [code=C] printf("Edit this record?(Y/N)"); scanf("%s", answer); if(strcmp(answer, "Y")==0) [/code] Which I believe should be changed to: [code=C] scanf("%c", &answer); //answer is a char, not a string if(answer == 'Y') //note the change to a single quote for a char, instead of double quotes etc. [/code] …

Member Avatar for Anbuvengeance
0
91
Member Avatar for jirving

First, I would change the variable "int o;" to some other name. Never use "o" or "O" for variable names, because they look too much like 0. Second, in your description of the problem, you are moving in the wrong direction. You start with the *smallest* column's number, and work …

Member Avatar for Adak
0
131
Member Avatar for SwiftDeath

I'll agree with you that you need help - anyone who names their array "element[]", is utterly at their limit! :) I don't agree with your algorithm, however. It looks like it will fail when you are sorting more numbers which are not favorably arranged already, but I haven't run …

Member Avatar for SwiftDeath
0
237
Member Avatar for Sa_FF
Re: sort

You didn't post the program - you posted "something like it". So it's not just a snippet of code which shows the problem, and it's also not the whole program. I'm not going to waste time with it. Your quote: [quote] [COLOR="Red"](if there is any undeclare variable just ignore.. it's …

Member Avatar for Sa_FF
0
145
Member Avatar for jirving

[QUOTE=jirving;640972]i need help on my homework problem. i have done the operations part (+, -, *, /, sqrt) but i am really having a [B]problem on making my calculator accurate up to 40 digits and to truncate all the non-significant zeroes on the output[/B]. i don't know what data type …

Member Avatar for Adak
0
293
Member Avatar for patel_anks

[QUOTE=patel_anks;640180]Hi can anyone help me, I am learning the language C but need some help writting some code. what i need to do is from the input of the keyboard i need to find the max and min of some values and out put them. what i got so far …

Member Avatar for patel_anks
0
110
Member Avatar for xlx16
Member Avatar for Adak
0
145
Member Avatar for red devils
Member Avatar for sivakrishna

[QUOTE=sivakrishna;633221]plz provide the c program to remove the blank spaces[/QUOTE] No. That's not what we do. The way it works is *you* post your code, and also post up a description of your problem or error with that code. We will take a look at it and suggest ways of …

Member Avatar for dwks
-2
168
Member Avatar for neknek

[QUOTE=neknek;633619]I have problems with searching & sorting strings in a file... I want to alphabetize the string so I did this [CODE]{for(x=0; x<100; x++) { for(c=x; c<15; c++) fscanf(stdin, "%s", student[c]->surname); if(strcmp(student[c]->surname,student[c+1]->surname)<0) {strcpy(temp,student[c]->surname); strcpy(student[c]->surname,student[c+1]->surname); strcpy(student[c+1]->surname,temp); strcpy(temp,student[c]->name); strcpy(student[c]->name,student[c+1]->name); strcpy(student[c+1]->name,temp); strcpy(temp,student[c]->number); strcpy(student[c]->number,student[c+1]->number); strcpy(student[c+1]->number,temp);} } }[/CODE] when i run the program, it just …

Member Avatar for ssharish2005
0
109
Member Avatar for beatlea

As I understand it, Binary search will always be faster if access times are constant (as in an array in RAM or cache), and Fibonacci search will be faster when the distance and access times, are proportional. Like on a hard drive or tape drive, where if the next item …

Member Avatar for Adak
0
142
Member Avatar for inventer

[QUOTE=inventer;634421]Hi! I am new to C programming, so this question might sound foolish. I have a problem with output of a program (sometimes the output is wrong) Following is the program: (I am using Turbo C compiler) /* Calculate simple interest */ #include <stdio.h> main() { int p, n; float …

Member Avatar for ssharish2005
0
244
Member Avatar for chandra1186

Imagine you're in a large house, with several rooms. Each room is a function: *you can only carry in *copies* of what you want, into each room, unless it's already been put there (ie, it's global in scope). *you can only walk out of a room, carrying *one* item *if …

Member Avatar for ssharish2005
0
245
Member Avatar for barbiegirl

Looks like the variable "num" is not returned to main, the variable "n" is never passed the value of num. That leaves your sorting function with 0 strings that are being asked to sort. Return num and assign it to n, and see if that doesn't help.

Member Avatar for barbiegirl
0
115
Member Avatar for Clockowl

Recalculating the time in every recursive call, get's quite expensive. Perhaps depth mod 8 == 0 would be enough? Also, you re-draw the board for every move. You only need to redraw two squares after any move - the from square, and the to square. It also gets rid of …

Member Avatar for Jishnu
0
164
Member Avatar for J-son

[QUOTE=J-son;626074]Can anybody help me to solve this problem? My program doesn't work as what it is required. Here is the question and my program code. Thanks. [CODE=c] /**Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how …

Member Avatar for J-son
0
111
Member Avatar for paolomontero

I don't have Turbo C 2.0, but this runs fine in Turbo C/C++ ver. 1.01, as a C program. Note int main and the include header. IIRC Turbo C 2.0 came before Turbo C/C++, but it's been a long time. [code] #include <stdio.h> void f(char *); char h[] = "hello"; …

Member Avatar for paolomontero
0
228
Member Avatar for Borgatto

Did you try my idea I posted on Cprogramming? Post up some code! Even if it's wrong, post up some effort you've made, and show us just what you want. There must be 100 different ways to make a status bar.

Member Avatar for Borgatto
0
110
Member Avatar for bobraj

May I suggest you use the digits 1, 2 & 3, instead of 0, 1, & 2? Because you can't "make" a number which begins with 0's: 01, 001, 02, 002, etc., are not a number. Anything beginning with a real number, would be fine though: 101, 20, 103, etc. …

Member Avatar for bobraj
0
124
Member Avatar for Brent_Ritterbec

Gaurau - Welcome to the forum! ;) This thread has been "dead" for several years, however. Please start a new one with your topic, and let these old threads, rest in peace. Maybe use the Google translator service? I can't figure out what you're saying.

Member Avatar for Brent_Ritterbec
0
325

The End.