949 Posted Topics
Re: The prototype should be: void toLowerCase(void); If you are receiving other warnings or errors, list them. If it's giving you wrong output, or messing up your input for some reason, show an example. To troubleshoot a program, you have to be active and work at it. P.S. What is the … | |
Re: Turbo C has conio.h, which you should include, for gotoxy(), so it's easy to put the text chars, wherever you want it to go. This works fine in Windows XP. (For other Windows user's, it's also easy, just include <windows.h> and use the API SetConsoleCursorPosition().) You have to decide what … | |
Re: I'll be the contrarian, and go with read in pivot number [CODE]if(number <= pivot) { deal with it } else { deal with it }[/CODE] If you want to sort - then sort, but only sort the numbers that should be sorted - so having two arrays (one for not … | |
Re: [QUOTE=jemz;1361967]Hello can you help me please... im making the program that will display the smallest number using function in array...please help me...thank you in advance...hoping for your positive responds.... [CODE] #include<stdio.h> void accept(); //should be void accept(void); void findsmallest(int num[],int size); //well done! int a; //should be removed int main(void) … | |
Re: What i like to have, is a menu function where I can choose to: 1) display one record I've searched for 2) edit a record I've searched for 3) display a group of records - say video's with titles beginning with the letter A,etc. Pausing between screens. 4) display all … | |
Re: Instead of assigning the Max value to 0 (which might fail if you were measuring Arctic temps in the Winter), assign Max to the first temp in your data. If a higher temp is found, then Max should be set to that higher temp, of course. If a higher temp … | |
Re: The program is using the last row's minimum, instead of the current row's minimum: [CODE] Original data: 999 54 48 92 24 54 999 32 61 35 but i'm getting output as....... 975 30 24 68 0 >> 30 975 8 37 11 Minimum here should be 32, but your … | |
Re: Look in the "number puzzle" thread. My last post has a very simple sort in it. (near the bottom of the program). @AD: What forum are we in -- std::sort ?? ;) | |
Re: Picture how it works: 1) The pre processor substitutes the numbersUL, for the expression SECS IN YEAR. 2) Now the compiler comes along and see's the number, but what data type (size) should it be given? General default is integer, which is not big enough on a 16 bit machine. … | |
Re: Sorry. Prim's algo is beyond me. That program doesn't look too difficult to follow through in a debugger, step by step. Good luck. ;) | |
Re: [url]http://en.wikipedia.org/wiki/Fast_Fourier_transform[/url] Way too big a topic to be covered in a post. Enjoy! ;) | |
Re: That's a great way to do it, (called "Counting Sort", sometimes), IF the range of the numbers, is not too large. Run time is O(n), and you can't beat that, as long as the range is suitable. | |
Re: That's C++, not C, so I can't help you. Obviously, you're not allocating the memory you need. When you can put in ten int's or so before the program crashes - that's an allocation that never worked. You should be able to test and see if the call to allocate … | |
Re: You want to draw something round? Round off a number? You need to be specific, and give an example of what you want. If you have some code for this, post it up! Tell us what has you stumped. A 13 word request for help, doesn't show that you're actively … | |
Re: Trying to debug that program is not simple - he has set in his logic using very specific values including "magic" numbers. His book doesn't show a diagram of what the circle should look like? Weird! When I ran it, I also got an ugly red square with barely rounded … | |
Re: Welcome to the forum, Priva.t! ;) A few very solid suggestions for you: 1) For your problems, unless it's EXACTLY the same, always start a new thread 2) You have to be VERY specific about what you are asking about. "Draw nonlinear objects", doesn't tell anyone what you are stumped … | |
Re: Your strings have no deep portions to them, so I'm confused. A deep part would be an array of pointers, where each pointer might point to a string, someplace else in memory. You see deep structures commonly. The struct has a char * as one of the struct members. Did … | |
Re: When you merged the arrays, you used pointers or indeces (int's usually), to help you do the merge. Now, you can use that pointer or index, to temporarily hold (or point to) a value - now any of several in-place sorters will do what you want. | |
Re: The first sort you listed is one I use as an "Easy" sorter. It's like a bubble sort, but simpler to remember and quicker to keyboard also. Performance is similar to, but slightly faster than, bubble sort. You can tell it's NOT bubble sort, because bubble sort compares only adjacent … | |
Re: I use a "step" kind of logic. Each check function returns either 1 (checked ok, or 0, check failed) [CODE]if(checkRow(row, col)) { if(checkCol(row, col)) { //only if row checks out OK, check the col if(checkBox(row, col)) { //only if row and col check out OK, check box number is OK … | |
Re: Think of it like three wheels on an old fashioned car odometer. Each wheel is from a different group, and each wheel can spin around, and then go back to it's starting value. Three nested for loops is the simplest implementation I know. Arrays are what I use, for each … | |
Re: You'll need a variable to count the loops, and then another for the upper limit: for(i=0;i<UpperLimit;i++) In this case, Upper limit equals both the longest number of char's in the last row of the pyramid, but also, the number of rows to be printed. Convenient. ;) How about a 'j' … | |
Re: You are clearing the screen, immediately AFTER you call the function! Try clearing the screen BEFORE you call the function! ROFL! ;) | |
Re: Selection sort does NOT compare every element, with every other element, every time through the loop - you misunderstood the algorithm. Selection sort is always a step better than bubble sort, in my tests on both random and real life data. Bubble sort and Gnome sort, are the slowest non-joke … | |
Re: HELP??? [code=c] #include <stdio.h> #include <math.h> #include <string.h> int main() { FILE *inputfile, *infile; double mark; int grade; ??? int avg = 0.0; int i = 0; char student[30]; char filename[30]; char *first, *last, *middle; printf ("Enter Name of Data File: \n"); scanf ("%s", filename); inputfile = fopen( filename , … | |
Re: Please stop posting other people's code! You were given these assignments so you could learn BY DOING them, how to program in C. Practice the exercise of your own logic, and learn C syntax and get an introduction to troubleshooting. All of these skills are essential for a C programmer. … | |
Re: That depends what data structure you made the stack with. For a linked list, you simply add the extra nodes you want, in a for loop, perhaps. For an array being used as a stack, you would include <stdlib.h> and realloc() more space. Array resizing should be done rarely, and … | |
Re: How about a little calculator? Go to Wikipedia, and read up on RPN (Reverse Polish Notation), or Tower of Hanoi, or a game of Blackjack, or Battleship or a simple encryption/decryption program, or Conways Game of Life? Whatever you choose, make it something that personally interests you. The guy who … | |
Re: In a previous version, i may have equaled the count of the numbers entered, but not now. Now you want i=0;i<count;i++ and %d, array[i] for the for and print statements, respectively. Technically, the top for statement should be "this < count-1". Why? Because next is always one element higher than … | |
Re: Please forget about the previous problem and the code that solved it - it puts the focus on something that is not the NOW problem. That's what to focus on. As you stated the problem, the answer is there is a HUGE number of n, that can't be exactly equaled … | |
Re: Dude, if you want help on the forum, then post your code on the forum. I went to your link and all I could do was get advertising and crap. Your file is apparently there, but you can't d/l it. Get real if you want help. | |
Re: You forgot the i++ in the first line of the for loop. | |
Re: May I suggest something more do-able? This just seems WAY over your programming level. Nevertheless - strtok() is the function most commonly used to "burst" words into a 2D char array, word by word. I can't say this is anything but rough code, but this will burst up to 120 … | |
Re: I would have guessed that "things don't work in a proper way". Way too vague, however. :( First, post your code with CODE TAGS around it, so it doesn't look like what the dog threw up last week, and second, post the errors - the SPECIFIC ERRORS, that you are … | |
Re: Because you have it set to return Boolean values (0 or 1), you can use a construct like this: [code=C] if(is_prime(number)) printf("\n%d is prime", number); else printf("\n%d is not a prime number", number); if(is_prime(number)) printf("\n%d is prime", number); else printf("\n%d is not a prime number", number); The return from a … | |
Re: Multiple column sorting sounds like multi-key sorting, where the column totals, are the keys. This is something YOU must verify. Only you know the instructor who gave you the assignment, and have the class notes, contacts, etc. Sounds like each key is ranked by it's priority, same as always. Please … | |
Re: Just checked, and there's a TON of sites on this topic, on Google. No code here, but this applet shows the actual "inner workings". Once you read up on it pretty good, go here and see the bits fly: [url]http://www.ecs.umass.edu/ece/koren/arith/simulator/Booth/[/url] | |
Re: guess and tries should be int's - you'll never have .23 of either! ;) Try adding a lo, mid, and hi variable. Then, when the guess is too high, bring down the hi variable to your current guess-1. When your guess is too low, bring up your lo to your … | |
Re: Your input stream is still holding the newline char. Remove it by adding this: (void) getchar(); After each time you're looking for a char input (getchar or scanf(%c)). fflush(stdin) is non-standard, and generally doesn't work, because stdin is an input stream, not an output stream. And [B]Welcome to the forum, … | |
Re: I use Turbo C/C++ a LOT, and it supports //comments, with either the C or C++ compiler. My version is 1.01 Your install may have become corrupted. Look for the Turbo C/C++ version, NOT the Turbo C version (which was earlier, and had significant bugs). Turbo C/C++ 1.01 is good, … | |
Re: I believe you're making it hard for yourself. Just: 1) Sort the data points for each row in the 2D array. 2) Print the stem, the | and the columns of data from that stems row of the array. And you're done. Don't use Rube Goldberg logic - simplicity leads … | |
Re: In this code: [CODE] void DollarsToYen ( float Dollars[], float Yen[], int count ) { int j; for (; j < count; j++) Yen = Dollars * DOLLARS_TO_YEN; printf("","The conversion of $ to y is %10.2f\n",Yen); } [/CODE] Dollars is an array, and you shouldn't be trying to multiply that … | |
Re: Include string.h header file, and use strstr() to check each line of text, in the char array "line". For each line, you may need to have two checks, one for each word, depending on the specifics of your search. If the words are found, print the line array. Note that … | |
Re: I'm not sure if you want to separate numbers FROM letters, or numbers AND letters, but: if FROM: Numbers have lower ascii values than any letter, so any char less than 'A' can't be a letter. if AND: Remember that a pointer or index can "walk" a string array, or … | |
Re: The simplest way to avoid this, on this forum, is to stay AWAY from "NIGHTS". He's a pointer fan, big time! ;) Seriously, use indeces (aka indexes), instead of pointers. Let C handle the change from index to pointer value. Are you trying to add up the whole array? | |
Re: Algoritmus, your code is OK. Understand that Ancient Dragon is being technically correct and please don't: 1) Get upset. Get comfortable in your skin, and "thicken" it. Don't feel threatened by a critique of your code or pseudo code. That's what we do here! 2) Please stop making excuses. "It's … | |
Re: You haven't given enough info to answer that question - there are many different ways to make a database. For the simplest - a "flat file", you have one or more data files, that are accessed by your program, as needed. If the amount of data is quite small, it … | |
Re: 1) check that the customer has given you an amount exceeding his bill 2) use this equation: amount given - bill equals change due back to the customer imo the easy way to deal with money is to multiply it all by 100, in order to eliminate any amount less … |
The End.