949 Posted Topics
Re: [QUOTE=ks94082817;1614764]suppose i want to read excel contents of 123 as 'one hundred twenty three'. please provide suggestion. srinivas[/QUOTE] First, you have to know how to read, and what an excel file is. It helps greatly if the excel file is with arm's length of your eyes Second, you need to … | |
Re: Line 39: [CODE]for(int j=0;j<=pos;j++) buffer[j] = '\0';[/CODE] Line 39 and 1/2: ;) [CODE]pos = 0;[/CODE] | |
Re: A simple game might have pseudo code for a game loop, similar to this: [code] int main(void) { char answer='y' while(answer == 'y') { prompting Do you want to play a game of ... ? [y/n]: scanf("%c", &answer); //get user's answer getchar(); //remove left over newline char from input buffer … | |
Re: If you just want to get rid of the newline char, this works great. Put it as the next line after fgets(): [CODE] int len=strlen(char_buffer); if(char_buffer[len-1]=='\n') char_buffer[len-1]='\0'; [/CODE] Your string will look like this after fgets(): my string\n\0 and what this makes the string into is just: my string\0 Because … | |
Re: You should post in the correct forum, and use code tags around your code. Hard to study the code unless you use code tags. | |
Re: Delete line 8, put lines 4 and 5, where line 8 is now. Right after the scanf() line, add this: [code] getchar(); //new line 5: difficulty = '0'; [/code] And you don't need to assign diff in two places. Just assign it once, just before you return from the difficulty … | |
Re: fflush() on any input stream, is undefined. It may work on some compilers and operating systems, but is not standard, and you'd be wise to use fflush() ONLY on output streams, not input streams. Think of it like the plumbing in your house. You can flush the toilet, but flushing … | |
Re: Game programs use a BIG loop to display the menu choices. They have calls to various functions which depend on the user's choice, and they will return to main (and end the program), when the user chooses the quit exit, or end choice. Usually, it's easiest to use a simple … | |
Re: Search Google for ROT13 and you'll have links. Wikipedia is usually good for info on things like this - might go there first, actually. ROT13 is just a simple replacement scheme. Each letter of the text is shifted up by 13 letters. That doesn't work for letter in the top … | |
Re: You did not declare a prototype for your function. Default would be an int, which doesn't match what the compiler sees, when it gets down to the function. Put your function prototypes above main(), with the right data types (the actual names of the variables are not needed), just int, … | |
Re: C always passes parameters by value (a copy), BUT a copy of an address (like a pointer), is REALLY still an address, isn't it? So there's your copy by reference or address, right there. Remember also, that an array, when being sent as a parameter to a function, will always … | |
Re: If by "word file" you mean a text file, just use fopen() with the name of the file (surrounded by double quotes), and the file access mode of "w", and after you've written out your text, fclose(filePointerName), the file. If you mean export your C text file, in Word (the … | |
Re: Visual Express, Code::Blocks, and my current favorite (for Windows only), Pelles C. There is a definite learning curve when you move to any new IDE, but overall, they increase your productivity quite a bit for C, in my experience. I'm shocked that anyone would suggest using a command line (terminal) … | |
Re: If you have the compressed version, uncompress it (7zip works well and is free from the download.com site and others). Then read and follow the directions in the readme file (I can't recall if it's in TC or TC/BIN, but one or the other). You may need to add TC … | |
Re: Forget your code. Take a pencil and paper, and draw your array of 4 x 4 (or 2 x 2), whatever size you need. Make it simple as you need it to be. Now, look at the paper from above, paper flat on the table or desk. Now slowly turn … | |
Re: [QUOTE]575,00 0,0 0,0 0,0 0,0 0,0 0,0 580,00 1,0 0,0 0,0 0,0 0,0 0,0 587,00 2,0 0,0 0,0 0,0 0,0 0,0 633,00 3,0 1,0 0,0 0,0 0,0 0,0 675,00 4,0 2,0 1,0 0,0 0,0 0,0 726,00 5,0 3,0 2,0 1,0 0,0 0,0 801,00 6,0 5,0 3,0 2,0 1,0 0,0 907,00 … | |
Re: IIRC, you needed to create a new project - to always have a "default project", so the IDE would have one to open. In your borland directory (either TC or TC/BIN), you should have a readme file that has a lot of info on stuff like this. | |
Re: Your program is written in C++, so you're in the wrong forum. An if statement in C looks like: [CODE] if(test statement) { //test statement was true or non-zero printf("\nThat statement was true or non-zero.\n"); } else { //test statement was false or zero printf("\nThat statement resolved to false or … | |
Re: Your indentation is horrid, of course. I believe your problem is that the scanf(), for a char especially, is troublesome, because scanf() always leaves the newline behind (when the user hits enter a newline is sent to the input buffer, as well as the keystroke he hits). To remove the … | |
Re: In my class (all one of them), the instructor taught us to use the Top Down design method. In a nutshell: 1) Study the problem, better than you believe you need to 2) Put off all the details you can, for now. 3) On paper, note the functional separations you'll … | |
Re: Muthmuth, it's far better if you: 1) Wait until the poster has made at least one solid attempt to write the code themselves, before you write code for them. 2) Use code tags around your code, ALWAYS. Just highlight your code and click on the [ CODE] icon at the … | |
Re: I'm not sure what the Dietal book presented, so let me recommend the bible of C, "The C Programming Language", second edition, by Kernighan and Ritchie. This is the "heart" of C, by two of the developers of it. It's excellent, and definitely "meaty", in a good way. Although none-too-fat, … | |
Re: You don't need to post up the whole program, just post up the smallest example of the problem you're having, in a snippet of code that runs and shows the problem. Sometimes, the doctor must actually examine the patient. ;) | |
Re: Welcome to the forum -- but if you don't show some work toward your query, you won't get help (99% of the time). That's a "rule" in most programming forums, btw. Otherwise, we become a free homework service, while you party on. You see the problem, yes? | |
Re: Tubby, Salem is one of the most prolific C repliers on the C forums. What he's talking about is that people post the same info on several boards. Then people like him answer them, ON EACH OF THE SEVERAL BOARDS. That means there's a tremendous amount of duplicated work, especially … | |
Re: You could have fixed length structs (records), which are normally written out in binary mode, and read in as binary data, using fwrite(). For structs of varying length, (where any member of the struct might have a varying length), the advantages of binary mode just fade away, and they should … | |
Re: [QUOTE=celestial_sea;1592850]Hello guys! i really need your help. In my program, I am reading the contents of the file. File looks like this: [CODE] 1 ART ACE APE 2 BAT BOY 3 CAT COP CUP CAP CUT [/CODE] I want to store the words in an array. one array per line. … | |
Re: Whether you do this in Linux or Windows, the logic is about the same. The page is a perfect representation of a 2D char array. You need to print out a test sheet to discover: 1) What is the top left char that can be printed by the printer 2) … | |
Re: Good! Now tell me when you know that the word to replace, has ended? 1) a space is reached, obviously ;) 2) an end of line char is reached, of course 3) what about EOF (end of file), and punctuation char's? Lots of details when you deal with strings, language, … | |
Re: [QUOTE]group the numbers in the file into 7[/QUOTE] Into 7 what, seven columns per row, seven rows, seven digits per column, seven digits per row? Show an example: Input, and what you need for your array. Your description leaves a lot to be desired. An example would serve much better. | |
Re: Using a basic for or while loop, perhaps: [CODE]set i and j to zero while(i is less than 12) { a[j]= index[i++]; b[j] = index[i++]; ... etc. j++; }[/CODE] | |
Re: [QUOTE=tlox;1592631]Thank you for your response I was not talking about the windows help system. I mentioned the HTML Help Workshop 1.4 as a software i would like to open the directory with. It is a software used to open/read some e-books. The directory should be static HTML page or application. … | |
Re: Welcome to the forum, Dharma. :) Two suggestions for your study in C: 1) for technical reasons, C should always have an int return from main. The correct format for main in these programs would be: int main(void) with return 0; at the end of main. I know void is … | |
Re: I really like the way you're thinking on this! Well done. fgets() is what you want, but you're quite right that fgets() has to go char by char (at a very low and fast level), to find the end of each row of text. It is NOT the same thing … | |
Re: Line 41 - C'mon, you're not ready to open anything yet. You have to get the filename first. Delete this line. Line 44 - You can't use a char array variable, without first declaring it. Declare fName first, then use it. (and don't make it too small). Line 45 - … | |
Re: It should be obvious by now that this exercise requires SOME type of looping. Recursion is just a different way of looping. Whether the looping works with the program code, (in whatever logic), the operating system, or even the underlying hardware, it makes no difference in terms of the logic. … | |
Re: It isn't clear what you want, but what is clear is: 1) You need to learn some basics before you start programming in C. Run through some of the many tutorials that are on-line, or study and practice from a book. 2) Unless you are required to use Turbo C, … | |
Re: Think about the flow of the program, and work it through with paper and pencil first. Open the file, read the contents line by line with fgets(), until you reach the words to be replaced. All the lines are being written out to a second filename. Acquire the new word … | |
Re: When you run a program and the first choice shows nothing, it's safe to say it's lacking! :) I re-worked Choice A, but the answer is being written out in reverse. You need to take the digits and first put them into a small array or LIFO buffer of some … | |
Re: Windows has always allowed programs to use the various ports and keyboard input. Can you do it without working through Windows on Win98 SE, -- I'm not sure. If you're thinking about making a keylogger, stop right there. They have a serious risk of being misused - whether it's by … | |
Re: I don't have time to work with this right now, but I was wondering if a very short recursive function could help? | |
Re: You don't need the Pearl script at all. Do you have the dictionary file yet? Forget the Pearl script, get the dictionary file, and take just copy the first 10 words of so, out, for a test file. Now, what problems do you have? | |
Re: First, use code tags around your program's code. Nobody wants to study code that looks like the dog's dinner, two days ago. ;) Second, narrow it down. WHAT do you need help with? Are you getting the mean calculated OK? Narrow down what we should focus on, and save us … | |
Re: .2 is an output format specification. You are using it in your input format specification for the float. | |
Re: Turbo C and Dev C are OK for small exercises, but Dev C is no longer supported (hasn't been for some years now), and Turbo C is 16 bit, which is very limiting for it's data sizes. Also, far pointers in TC are not possible (the memory model is all … | |
Re: Since the number being tested is an integer, and the actual square root value (the floating point value), is meaningless in this context, using just the int value of sqrt(n) is fine - and smart. However, you are now recalculating this value (the int square root of n), over and … | |
Re: To show shapes and ALWAYS to post code << Use [Code] tags >> Then the editor will retain ( more of less ;) ), the shape you want, AND the code will be shown in a font that's easy to study code with. Click on the [CODE] icon in the … | |
Re: A far better choice: Pelles C - free (only for Windows), but 32 or 64 bit, and unlike Turbo C (which I dearly loved btw), it's up to date, including having it's own support forum. Like Turbo C, it's intuitive to use, and has plenty of help. You'll love it, … | |
Re: [QUOTE=venomxxl;1525399]You are using some confusing terminology. If you want to [B]treat[/B] memory as if it was a disk, you might want to look into tmpfs or something like that. Or you could attempt to create your own fs "format". Are you supposed to write a driver? This seems like a … |
The End.