949 Posted Topics

Member Avatar for twedel10

I doubt that you'll get what you want just by asking. We help people who want or need to program in C, and are able and willing to work. If you want help, you'll need to get cracking, and post some work up. Ask specific questions about whatever has you …

Member Avatar for Adak
-1
119
Member Avatar for snivas519

The getstr function is dodgy. scanf() is looking to take in just one char, but the user is trying to enter a string. And scanf() has to have an enter key to assign a value (buffered input). fgets() is the function that immediately comes to mind for string entry. Overflowing …

Member Avatar for snivas519
0
260
Member Avatar for tots08

One obvious problem is that the program closes the files AFTER the program has ended <so it's not closing the files, at all>. Your IDE MAY close the files for you, but that's your IDE, not your program. I don't see anything wrong with the rest of the program. Exclusive …

Member Avatar for tots08
0
264
Member Avatar for daredevil786

Think of %l as just ONE thing - a format specifying the data type to be printed. So what's left is just one % char to print.

Member Avatar for MareoRaft
0
123
Member Avatar for srinivas88

The outside sources may have become scarce, but you can always try and work it out, yourself. The language is not the problem, but the logic you will need, to do this -- that's what you need. Do you know how to transform this data from one type to the …

Member Avatar for Adak
0
149
Member Avatar for hfactor9

What have you considered or tried? Post up what you have done, and we'll help answer any questions we can.

Member Avatar for Adak
-1
102
Member Avatar for snivas519

Best explanation for it is on Wikipedia. Bookmark Wikipedia if you haven't done it already. They have a huge amount of programming pages, and a portal just for algorithms, IIRC.

Member Avatar for snivas519
0
77
Member Avatar for anzoo2009

Welcome to the forum, Anzoo! ;) Here's the way to use the forum - give your assignment a good try, and then post your try. Tell us what has you stumped. If we don't do that, we become "homework coders" for everyone (or so it seems), and the students can't …

Member Avatar for anzoo2009
0
94
Member Avatar for xheavenlyx

It all depends on how fast you need to develop the program/robot, and how fast you need the program/robot, to respond or to perform. Python would undoubtedly be easier to develop than C or C++, but you'll never get the responsiveness in Python or Java, that you would get in …

Member Avatar for stevephillips
0
218
Member Avatar for indianscorpion2

The factorial function doesn't have a prototype in the program. My compiler wouldn't complain about this, since factorial() is above main(), but strictly speaking, it's bad form. Does your compiler want another include file added to support long long int's?

Member Avatar for Adak
0
176
Member Avatar for gahhon

if() and while() and for() statements all have a test. The answer to that test will be either zero or non-zero. A zero answer means the test result evaluated to false. A non-zero answer means the test result evaluated to true. [CODE] if(0 < 1) { printf("\n Zero is less …

Member Avatar for Narue
0
135
Member Avatar for guru_iyer

int width = 7; Then replace your blank printing loop with: [CODE] for(k=width;k>(i*2);k--) { printf(" "); } [/CODE] Note that the loop above prints just ONE space char, at a time, instead of two space chars, as the current loop you have, does.

Member Avatar for Adak
0
148
Member Avatar for watery87

Use while((fgets(bufferName, sizeof(bufferName), filePointerName)) != NULL) { instead. Testing for the end of the file has become quite unpopular (and deservedly so), for just this reason (among others). Don't use it.

Member Avatar for zerocool21
0
103
Member Avatar for kimimaro

Watch your dates, Acer - this thread was from 2004. <Yikes!> ;) And Welcome to the forum, Acer!

Member Avatar for Adak
0
253
Member Avatar for ellenski

Easy does it Ellenski. If Ancient Dragon recommends something, I'd read it. He's one of the most knowledgeable posters you'll find. I, on the other hand, know just about zip about BST's, but clearly you need to adjust the left and right pointers to the nodes that are linking to …

Member Avatar for ellenski
0
199
Member Avatar for Nandu Das

If the compiler's error or warning says the function should return a value, then I'd try and have the function return a value. ;) Prototype your functions, and make sure the actual function return types, match the return types of your prototypes.

Member Avatar for $urya
0
71
Member Avatar for jemz

Sorry, you need to show some work on this. Just posting your assignment and waiting around for some shmuck to do your homework for you, doesn't meet the requirements of the board. I find it impossible to believe that you can't figure out how to calculate the charges and time, …

Member Avatar for Adak
0
681
Member Avatar for daredevil786

I refuse to answer, on the grounds that you should be enthusiastically TESTING this yourself. ;) Put down your latte, take 30 seconds, and test it, FCOLoud!

Member Avatar for Adak
0
101
Member Avatar for watery87

I can't tell you, but I can tell you how to troubleshoot it: 1) Copy down the EXACT error message, for reference 2) comment out the calls to functions, one by one, until you find out which function is causing the error. 3) going into that function - comment out …

Member Avatar for watery87
0
314
Member Avatar for sanz

For a beginning student, TC can work fine. There's no doubt TC is the easiest and the fastest IDE to set up, and get help in. It works fine in XP and all earlier versions of Windows. Naturally code blocks or visual express would be better choices, but they can't …

Member Avatar for Adak
0
2K
Member Avatar for arsenal_fan

You should return the index to the number, not the number. Then use the index, in main(), to print out the number. Free the array whenever you no longer need it. And you don't need to cast the return from malloc, in C.

Member Avatar for griswolf
0
95
Member Avatar for creeps

I surely don't like it. I can see having two returns in a function. One is preferred, but two is OK. Four returns in one function, is not OK. mid should be set in ONE line of code, outside of the if else statements instead of being inside, in two …

Member Avatar for Adak
0
149
Member Avatar for gahhon

continue statement is designed for loops (for or while, or do while). Wouldn't make sense to try and use it in an if/else statement. You can have a "do nothing" in an if statement, however: [CODE] if(numberOfApples > 1) ; //nothing gets done else printf("\nNo apples here yet!"); [/CODE] Good …

Member Avatar for ciint
0
119
Member Avatar for okwy

You'll find this much easier if you use a bit of top-down design here, especially: [B]Put Off The Details[/B] Get the basic control and flow working, then get your details going, [COLOR="Red"][B]LATER.[/B][/COLOR] You have a source file, and it has 30 names of other files in it, or what? Because …

Member Avatar for Adak
0
204
Member Avatar for libathos

Sorry Libathos, that sounds a little too virus-like/malware type programming, for me. "Beware the Dark Side of the Force", Libathos.

Member Avatar for libathos
0
94
Member Avatar for chrysanterus

Welcome to the forum, Chrysanterus! Always better if you start a new thread for a request. I've zipped up all the example programs that I got with Turbo C. You can d/l the self extracting file from Swoopshare, here: [url]http://en.swoopshare.com/file/71f8ef6d5a664112a30d0c420ec58218/TCexamples?tags=TCexamples&lang=en[/url] note that this is from an early version. Since then, …

Member Avatar for abhimanipal
0
126
Member Avatar for piro87

You'll certainly want to open the files in binary mode. First thing I'd do is write a function that will open and copy a solo and regular JPG file, and make sure it can be then viewed OK. Then, I'd see about getting the smallest *.RAW file I could, with …

Member Avatar for Adak
0
832
Member Avatar for vicky_rawat

That's over my head, but this file seems loaded with info - it's not free, however. :( [url]http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6WGK-4N7S53V-1&_user=10&_coverDate=07%2F31%2F2007&_rdoc=1&_fmt=high&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1418901380&_rerunOrigin=google&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=405e0005965da2ca0c53dd9d9bda1f77[/url] Gotta be the longest url I've run across in a long while!

Member Avatar for Adak
0
101
Member Avatar for maxzoran

You need to remove the return of float from your function (make it void), and remove the print in main, asking for a string. gets() is NOTORIOUSLY unsafe - use fgets() instead. And indent your program, so it makes sense to read it. It's a mess* this way. The closing …

Member Avatar for Adak
0
209
Member Avatar for apolochaves

My suggestions: 1) change the value for alive or dead to 1 or 0. The printout can easily show a dot for 0, and 'X' for alive. 2) Delete the defines in red. 3) Instead of 'V1', etc., name your directions something you can intuitively associate with the 8 directions: …

Member Avatar for Adak
0
124
Member Avatar for phillstarr

Welcome to the forum! You obviously need to add some logic here - hardly a surprise that month needs to be set to 1, along with the day, at the end of the year: [code] if((day == 31) && (month == 12)){ printf("The date of the next day is: %d/",nextday); …

Member Avatar for Adak
0
83
Member Avatar for madhusingh123

By "project", do you mean a "final year" type of programming project, or do you mean a project inside your IDE (your compiler)? And welcome to the forum! ;)

Member Avatar for vijeta sharma
0
90
Member Avatar for potato4610

This is another of those "your assignment is to eat, but you can't touch the food with anything", kind of an exercise. ;) Which means the lecturer will have given you hints (maybe subtle, maybe not), about how he/she wants you to proceed with this. Review your class notes, and …

Member Avatar for kings_mitra
0
190
Member Avatar for garyengle

You defined your struct, and made a pointer to it, but I don't see an actual struct being declared. Also, scanf() needs a getchar() after each instance, if you want to keep getting char's from it. Need to pull the newline char, off the keyboard buffer.

Member Avatar for garyengle
0
144
Member Avatar for rje7

Obvious errors. If you want a nice round clock face, you need to work with a graphic mode console, not a text one, and then use math.h to calculate the number of degree's or radians needed between numbers. If you want a square one like the red one at the …

Member Avatar for Adak
0
104
Member Avatar for atechnikality

You wind up comparing a char, to a string in words - that won't work. In your call to findchar(), I'd just pass the one word that you will be checking, rather than the array. You seem to be confused about that, so: words[random_word][] should do. ARRSIZE sounds wrong, also. …

Member Avatar for atechnikality
0
1K
Member Avatar for ganav

Check out your help index for "Virtual Keys" or "Virtual Keyboard". If you have nothing there, go to the MSDN library - it is definitely there, with an example program, as well.

Member Avatar for Adak
0
105
Member Avatar for libathos

You opened the file for writing. I'm guessing it should be closed before you call CopyFile. Adding code tags (click on the [CODE] icon at the top of your editing window), improves your code's readability, greatly.

Member Avatar for libathos
0
145
Member Avatar for jbronen

Are you trying to change a CONST value? If you add something to the file name, you are renaming the file. If you just want to "touch" some file values, I believe you do that through the FILE pointer struct, associated with that file name. by "touch" I mean the …

Member Avatar for jbronen
0
831
Member Avatar for bunty_kkp

That is a different problem than what you posted, above. Extracting m characters, beginning with the nth character, means just that. It does NOT mean "scan the char string for some char and when found, extract m characters". If you want to post code, PLEASE click on the [CODE] tag …

Member Avatar for Nick Evan
0
243
Member Avatar for CodeAerial

I am NOT going to tell you this answer - you would hate that, surely. if(hint, hint), EITHER the multiplicater, OR the multiplicand, (but not both!) are negative, what will you have to put at the very end of your function, to make the logic correct? C'mon! ;)

Member Avatar for Liyaan
0
1K
Member Avatar for KSGuan

The fastest way to do this, is to: 1) Get your basic FLOW and calculations of the program, working correctly. At first, just display it on the screen - it's faster, and so easy to go back AFTER you have the basics right, and change the printf() statements, to fprintf(), …

Member Avatar for codewriter_IND
0
127
Member Avatar for KV305

It will compare the two strings: strcmp(string1, string2); If the return value is greater than 0, string1 has sorted higher than string2. If the answer is anything less than 0, then string2 has sorted higher. [B]string1 [COLOR="Red"]>[/COLOR] string2, return [COLOR="Red"]>[/COLOR] 0 string1 [COLOR="Red"]<[/COLOR] string2, return [COLOR="Red"]<[/COLOR] 0; [/B] You can …

Member Avatar for Adak
0
120
Member Avatar for m7r23

Assign the largest number initially, to the value of the first element of the array. Assign the 2nd largest number initially to INT_MIN (your compilers macro for the least possible value for an integer. That makes the "mouth" for trapping the numbered values you want in the array, suitable. (Your …

Member Avatar for jeevsmyd
0
185
Member Avatar for danswater

This is Turbo C guaranteed! ;) [CODE] /*Here is the code I wrote up to solve your problem. c Syntax (Toggle Plain Text) */ #include <stdio.h> #include <stdlib.h> int main() { char two_digit[3]; int digit; printf("Enter two digits: "); fgets(two_digit, 3, stdin); //Accept size-1 (in this case, 3-1 which is …

Member Avatar for danswater
0
99
Member Avatar for Jamesbch

I don't believe there is a problem doing this, you're not bringing your pointers or member operator on down to the right level. Using the dot operator, I would say: parent.nameOfField.nameOfChildStruct.fieldIwant You can do the same idea with pointers, of course.

Member Avatar for Adak
0
155
Member Avatar for chade25

fgets() DOES limit the amount of chars you can put into your buffer, but you never made your collection of chars in your buffer, into a legitimate string - it has no end of string marker. #include <stdio.h> int main() { int i; char buff[25]; buff[sizeof(buff)-1]='\0'; //setting the end of …

Member Avatar for chade25
0
118
Member Avatar for SHENGTON

When you see code like this, why not simplify it? [CODE] if(n == a[i]) { pass++; } else if(n > a[i]) { low = i+1; pass++; } else if( n < a[i] ) { high = i-1; pass++; } to just: pass++; if(n == a[i]) { return the i; } …

Member Avatar for Adak
0
135
Member Avatar for akvilio

You're on the right track. If you can't use an array, you can just assign variables for each digit. Here's an example of how to handle 0-4 digits. [CODE] #include <stdio.h> int main() { unsigned long n; //let's the number be rather large int i, zero, one, two, three, four; …

Member Avatar for akvilio
0
120
Member Avatar for kymarscheng

You don't mention the most important part of your program - does it work correctly? Everything else is secondary. Assuming it does work properly, then what deficiency do you notice or what is it that you want to improve? With a palindrome program, if it's accurate with all kinds of …

Member Avatar for urjapandya
0
152

The End.