949 Posted Topics
Re: if(s[j] = z[i]) Test for equality, in this line of code, don't assign a value. Then go ahead with your logic. I believe you can delete the Dummy variable, entirely. ;) | |
Re: I think you might have a problem with the two stack.h files you've included. calcstack.h and stack.h are likely to have some of the same definitions and leave the compiler tied up in knots. Check for keyboard errors in your code, if they're supposed to be compatible. Were you supposed … | |
Re: Flashback to my old Math teacher, "Mad Dog" Cameron: ========================================== [B]"[/B] Oh NO! It's too e-a-s-y!! Can't you see that you need to add an unknown to this? Can't you see that you need to then just solve it for the unknown? It's too easy!! j-2, when j == 9, … | |
Re: These lines of code violate the C standard, and are ridiculous to boot. If you dared to write a line of code like that on a job, you'd be in trouble, for sure. You can't stop this kind of question (and this thread), fast enough. | |
Re: Welcome to the forum. And no, I wouldn't do that. Turbo C is fine for just little assignments at school or home. Anything really good, you need to move up to something like MS Express or Code::Blocks - both are free, and have the kind of modern memory and features … | |
Re: [CODE]fscanf(FilePointer, "%f", &variableName);[/CODE] All the scanf() family of functions are subject to quitting the first time they receive data that they aren't set up to handle. It's important to check their return value to see if it actually worked or not, (it returns the number of items it has successfully … | |
Re: You have your string, and your width. You keep adding char's from your string (including the spaces), until you equal your width. If your last char is a space, or period (punctuation of some kind), then you're OK, as is. If you're in the middle of a word, then you … | |
Re: This sscanf() line looks dodgy to me. Test the return value it gives, and see if it's 2. [CODE] //Separa os indices sscanf(bdata, "[COLOR="Red"]%[/COLOR][^':']:[COLOR="Red"]%[/COLOR][^':']:[COLOR="Red"]%[/COLOR][COLOR="Green"]s[/COLOR]", p1,p2); printf("%s\n",p2); [/CODE] It has 3 [COLOR="Red"]%[/COLOR] char's in it, and 1 [COLOR="Green"]s[/COLOR] in it's formatting, but it's going into two variables?? If it's right, explain … | |
Re: The more your program does, and the more efficiently it does it, the higher the percentage of cpu utilitization will be. That's not a bad thing. Sometimes just a few lines of code will generate 100's of lines of assembly or machine code. If your program is starting to have … | |
Re: [QUOTE=Valdemar009;619080]Hi Everyone, I'm really fed up of working on C in Windows Vista. First and foremost, the window of C occupies only half the screen which is very annoying. I've heard that there is a distinct C that is used with Vista but I have failed to attain any more … | |
Re: [QUOTE=sam_dev;1171261]hi every body....... here i want to ask something about base64 algorithm which is used for the encryption of passwords.........i just want to know that how it works ?????what are the functions used in this algorithm?????any type help.....any link...????[/QUOTE] I'm not sure which cryptographic algorithms use base64, but here's some … | |
Re: You have codes for all of this and much more, if you have Turbo C! No one has to give you anything. :) Start up Turbo C/C++, and select "file" and "new". Now click on "File" again, and "save as". Give your file a short 8 character or less name, … | |
Re: What's your compiler? Just for giggles, try this: [code] float a[N] = {0.0}; [/code] and you can delete char buff[] because it's never used. | |
Re: Use fgets(CharArray, sizeof(CharArray), YourFilePointer); to put each line into the CharArray[80 or so], that you've previously declared. Now you can use for or while loops, to "walk" through the CharArray[], and pick out the tabs, and spaces, etc. When you find the line meets your needs, then put the end … | |
Re: You can't run Turbo C graphics on another compiler. I couldn't compile your program in Turbo C, since it was missing a parameter (noted on the line in question, below). But Turbo C is pretty sweet for doing small assignments and programs. I use it a great deal. The first … | |
Re: You have codes for all of this and much more, if you have Turbo C! No one has to give you anything. :) Start up Turbo C/C++, and select "file" and "new". Now click on "File" again, and "save as". Give your file a short 8 character or less name, … | |
Re: After you enter something with scanf(), there will always be a newline char, left in the keyboard buffer. If you are scanf()'ing for a char, that is critical, because the newline '\n', is itself, a char. So when scanf() pulls in the char (the newline), it says "I've got my … | |
Re: Here's some important things to do: 1) This is predominately an English language board. Translate your program into English, and re-post it. 2) In the advanced edit window, highlight your code and click on the [code/b]/b word at the top of the edit window. That will make your program look … | |
Re: Just use a different name - con is taken by the system. Doesn't matter how you try to get the program to use that name. System has first "dibs" on it. ;) | |
Re: What about using char ch = 'a'; and then ch++; 26 times? char toCap = 'a'; toCap -= ('a' - 'A'); int integer = 0; integer += 'a' for lowercase, Now print it with a %c and with a %d :) And what would it be to change an integer … | |
Re: [QUOTE=lionaneesh;1167457]Exercise 1-11. How would you test the word count program? What kinds of input are most likely to uncover bugs if there are any? Exercise 1-12. Write a program that prints its input one word per line. help me wid these questions temme the source code and the logic and … | |
Re: In the case statement, in addition to the error of #2, you have a potential error in case #1. You are asking calloc to give memory of some number * the size of an int. But you don't want the size of an int, you want the size of an … | |
Re: You have a 1 in the 100's column, a 2 in the 10's column, and a 3 in the 1's column. So you could look to swap the columns: [CODE] 1 2 3 X 1 3 2 X 3 1 2 X 3 2 1 X 2 3 1 X … | |
Re: Just main() means whatever the compiler accepts for it's defaults, are used. A return of int may also be the default of the compiler. int main () with no return should give you an error "function should return a value..." void main() is an error with the newest standards, AFAIK, … | |
Re: You could do a search that would be faster, but there is absolutely no need for that, in this game. A sequential search is fine! Some idea code - untested! [CODE] if(gameOn) loop for another player's turn else give congrats and goodbye message and exit this game in that function … | |
Re: [QUOTE=bahr_alhalak;1163694]it's not a homework . come on ,, no one want to help me[/QUOTE] BA: I want to help you, but you will also need to understand: 1) Obviously, this is an assignment, of some kind. Which is fine, btw. 2) On forums, post up your info, don't attach it … | |
Re: When you see code that so close to being exactly repetitive, it's time to look for better ways of doing this. ;) [CODE] int count_a; int count_b; int count_c; int count_d; int count_e; //etc. [/CODE] Just do a distribution count (aka bin sort), and be done with it. Use an … | |
Re: A simple while loop before the char's you want, is all you need. [CODE]i = 0; while(str[i] < 'A') ++i; //get your good input here //then ignore the rest of the char's.[/CODE] | |
Re: You will find it easiest using fixed lengths for each field, and thus a fixed length for each record. Every item then fits nicely into this struct (where each struct member is a field, and each record is a struct. A simple example: [CODE] struct item { long prod_num; char … | |
Re: Check out postfix and polish notation (or is it reverse polish notation?), anyway, they make doing this kind of parsing, rather easy. | |
Re: Wow! Edlin takes me back. Used it in my first computer language, BASIC. Now I find it hiding in WindowsXP, and still working!! | |
Re: You have a double linked list. If you want to print another node of that list (another structure's worth of data), then go to that node, and print it. You don't print a structure, from another structure. Structures just hold data, and are not "Objects" with the ability to print … | |
Re: [CODE] # printf("\nStudent [%d]\n",i+1); printf("Student name: "); scanf("%s",Stud[i].name); printf("Course: "); scanf("%s",[B][COLOR="Red"]&[/COLOR][/B]Stud[i].course); [COLOR="Green"]/* Course is a char array, so the name of the array is the address of the base of the array. Delete the '&'. */ [/COLOR] [/CODE] I did not review the rest of your code. If it still … | |
Re: I'll take a look at it in about 2 hours. May use an array instead of a stack, but we'll see. | |
Re: You need to draw an arc in order to get the (circular), cut-outs that your picture has. Instead of a triangle with "line, line, line", think NOT a triangle, and "line, arc, line, line, arc, line, and line arc, line". Once you learn to draw an arc, you'll have no … | |
Re: C doesn't know anything about a CD drive. Your computer knows about the CD drive, because it has a driver that handles it. C just passes the request along to the operating system, and the operating system passes it along to the driver. That's why you can't use a device, … | |
Re: The codes shown above this, require that your system has the ANSI.sys driver loaded. (shades of DOS!) I don't have it on my WindowsXP, system, so it won't work for me. If you're working or writing code for a Windows system, I strongly suggest you use the Windows API for … | |
Re: Blowfish has been passed up by newer encryption algorithms that are faster and better. Most notably, by Rijindael. PDF on it is at: [url]http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf[/url] National Institute of Standards and Technology finished an exhaustive test of all the top encryption programs, and made their selection. Google N.I.S.T, encryption selection, and check … | |
Re: look VERY carefully at Target and myaddressbook.name, and you'll see (I believe), one of them has a newline that the other doesn't have. That's what's tripping up strcmp(), and your search. | |
Re: Wouldn't it make more sense to put each digit of one number, into it's own element of one array, and do the same with the second number, into the second array. Then, in a loop, starting at the one's (right hand column), start adding, and remember, any sum above nine, … | |
Re: While you're getting their name, don't you also want to get their exam score? Are you going to use parallel arrays student name <==> their score sharing the same index, or what's your plan for that? I like all the major functions to be up above main(). Easy to refer … | |
Re: We're not in the "given me code when I ask for it with a half-dozen exclamation points on the end", business. You must have us confused with some saps who think you deserve everything you ask for, when you ask for it, for free. ;) | |
Re: I don't know about helping you "get" code, but I can help you *write* code for this histogram. What do you have for input, (how is it organized, especially)? [B]Post up your code[/B] that you have so far - you do need to show some work, here - and make … | |
Re: This program shows how to do a simple selection sort (almost the same as a bubble sort), keying on one column of a 2D array. [CODE] /* shows how to a 2D array, using one column (the last column) as the key. */ #include <stdio.h> void printArray(const int a[3][4]); int … | |
Re: Why NULL out any char's? Your buffer[index] is currently OUTSIDE a parenthesis or double quote, or And you program should start as OUTSIDE. Your buffer[index] is currently INSIDE a parenthesis or double quote. Both cases have to be dealt with. When buffer[index] goes INSIDE, then match equal's ')' or '"' … | |
Re: If it's for the screen, you should add some line of like this, inside your for loop: [CODE] for(i = 0; i < SomeBigNumber; i++) { if(i < 20) your print line of code goes here } [/CODE] That will let the only the first 20 lines of code be … | |
Re: On this forum, we try to NOT give out code, until after the poster (you), have shown some work to make the program. We want to HELP, not become "homework central" for every student who would like to have their assignment done for them. Do you see what I mean? … | |
Re: Suggestions: 1) "Beginning C Programming" by Ivor Horton - fine book! 2) Many on-line tutorials, like the one on this very site (right hand side)--> 3) Keep reading a couple good and busy, C forums. You'll pick up a lot, and keep from forgetting what you've already learned. 4) Find … | |
Re: Empirically, you have proven that it is indeed, too large. Remember, not only must that quantity of RAM be present, but it also must be contiguous. Also, you are asking for memory only from the stack. Try re-booting your system (to enable the largest RAM possible), and if that should … |
The End.