949 Posted Topics

Member Avatar for smith32

ddd ccc eee is not in sorted order, so I'm not sure if you want to sort in ascending or descending order. You should keep the 2D array, no need to change that. you can't use temp like you have it in the sort portion. When you assign it to …

Member Avatar for Adak
0
222
Member Avatar for macrogeek

No casting or typecasting is needed for malloc(). It returns a void pointer which the program will automatically change to the right type, for you. Very rarely, you'll need to do a cast of the pointer, manually. You need to include stdlib.h for malloc to work. If you need more …

Member Avatar for manojwali
0
214
Member Avatar for king chandel

I don't know a single one, it's a diminishing language for studying. Google does have lots of hits, however. Several tutorials included.

Member Avatar for Auraomega
0
92
Member Avatar for scholar

You can't delete an element from an array - they are fixed. Why don't you post a simple example of what you want to do. Your description is dodgy, (or maybe it's just too early?). ;)

Member Avatar for Adak
0
161
Member Avatar for challarao

Are you trying to USE atoi() in your program, or are you trying to make your own atoi() function? The C atoi() function will need a pointer to the char array, not this: atoi({abcdefghij}); I have no idea what the abcd... stuff is all about.

Member Avatar for Adak
0
124
Member Avatar for lucy1234

Sure! Why not? Here's the thing -- you have to contribute idea's and sometimes, code into this. I'm not going to just post up a program for you, and I hope you don't want to be a "code leech". So, what does your instructor say to use for an algorithm …

Member Avatar for Adak
-5
2K
Member Avatar for jeevsmyd

rand() can give you a specific range of random numbers. Just set it up for 1 to 5, four times. 1 2 3 5 Inside a loop, you can put the "number" together, from those digits if you want: 5 * 10^0 + 3 * 10^1 + 2 * 10^2 …

Member Avatar for Auraomega
0
436
Member Avatar for GMSI

This link has Turbo C/C++ 1.01, which I strongly recommend, because: 1) It's a newer product, and has fewer bugs than the older Turbo C 2.0 2) It has both a C++ and a C compiler - files with a dot c filename will be compiled with the C compiler, …

Member Avatar for Adak
0
774
Member Avatar for b1izzard

Here's one big error: [CODE] scanf("%s",inpt_str1); for(i=0;inpt_str1[i]!='\n';i++) { len1+=1; concat_str[i]=inpt_str1[i]; } [/CODE] scanf() does NOT include the newline char, into the string - that's fgets(). scanf() (infamously!) leaves the newline behind. So there is no stopping your loop. Change the '\n' to '\0' (the end of string marker) (which scanf() …

Member Avatar for b1izzard
0
128
Member Avatar for sabeeh ahmed

You need to ask questions about your program, rather than posting your assignment and saying "thanks" for the solution. It is your assignment, after all. You won't learn by not working with it. And Welcome to the Forum, Ahmed! ;)

Member Avatar for sabeeh ahmed
0
92
Member Avatar for dayju

You only need to include struct members for fields that you need. For students: idNum, fname, lname, gradYr, course, and DOB (DOB=date of birth). You don't list it, but it's quite standard. Course would be their major field of study perhaps. Sounds like all you'll need, from your description. Before …

Member Avatar for dayju
0
144
Member Avatar for JSpudMonkey

Just a quick note: 1) On programming forums, you NEED to use CODE tags. In the editing window, highlight your code, and click on the [CODE] icon. Otherwise, your code is difficult to study, and will be generally ignored. 2) You don't have any #include files listed in your program. …

Member Avatar for JSpudMonkey
0
127
Member Avatar for DemiSheep

You need to use ARRAYS of structs, of course - if you have multiple cars to track. ;)

Member Avatar for jon.kiparsky
0
192
Member Avatar for acer5542

I'm not familiar with emulators, but suggest: 1) Use #defines for the memory addresses, to clarify things with them 2) Tell us exactly, *what* is it that has you stumped "Needing help" doesn't bring a focus to anything specific enough to tackle. I doubt VERY MUCH if anyone is going …

Member Avatar for Adak
0
117
Member Avatar for nur syahirah

I'm hesitant to say I can answer your questions - but I've done a lot of programming in Quickbasic Pro. Post up what you have done, and what specifically you need help with. That's the only way that anyone could help you.

Member Avatar for Adak
0
43
Member Avatar for sayantani nath

You might want to read up on base 2 (binary), base 16 (hexadecimal), and compare how they work, with what you know about base 10 (our normal number base). What specifically is it that you need help with? Can you post code to show what you're trying to do? And …

Member Avatar for Adak
0
55
Member Avatar for gameon

A text file will be given certain translations (like a newline char gets changed into a CR/LF combination of two chars). Open the files in binary mode: "rb" and "wb", for sure. Then you *may* need to change char c to an unsigned char. And on the forum, highlight your …

Member Avatar for Adak
0
82
Member Avatar for gaurav_13191

If you're taking a class, use the compiler that the teacher will be testing you and your programs, with. There are two highly rated free C compilers that I know of. One is Microsoft's Visual Express (Google for a d/l site). The video is helpful to d/l as well. The …

Member Avatar for gaurav_13191
0
109
Member Avatar for DemiSheep
Member Avatar for Ancient Dragon
0
129
Member Avatar for srinivasan106

I don't like your algorithm, nor do I see anything "divide and conquer", about it. Try this: 1) take in all the numbers of the array, then 2) use Quicksort to sort the array Quicksort is a *brilliant* example of a divide and conquer algorithm.

Member Avatar for ananda2007
0
154
Member Avatar for sap.queue

To have your code look like code (and be easily read), highlight your code, and click on the [CODE] icon in the editing window. You need the code tag without the backslash char: '/', before the program starts, and the code tag WITH the backslash char, placed after the program …

Member Avatar for ananda2007
0
147
Member Avatar for uday jha

First idea, is to use a keyboard and editor, ;) but seriously, read up on permutations and programming in general. This is not a trivial "Hello World" kind of program. Second idea, is to consider that hacking into someone's computer is a crime in most jurisdictions, and that your time …

Member Avatar for Adak
-6
92
Member Avatar for blorgit

click on the "Snippets" tab, and study the Binary Search snippet. Your logic is *way* off the mark.

Member Avatar for Adak
0
127
Member Avatar for sujisubha

You don't need us to try and fill in a books worth of info, on image compression. Use Google and be prepared for a lot of reading. There are dozens of image compression formats already developed. Why do you need a new one? It's not like these formats are worn …

Member Avatar for monstercameron
-2
89
Member Avatar for LuciaP

Unless the input is *strictly* formatted, don't use scanf(). You want a char buff[90] (nice and big) to hold a full line of input from the user or file, *PLUS* one newline: '\n' char and one end of string marker char: '\0'. The format for it is: [CODE] char buff[90]={'\0'}; …

Member Avatar for LuciaP
0
203
Member Avatar for sujathaarsid

I would use logic like this: [This is not "code", it's pseudo code, in C format. Difficult to describe it accurately, without code like syntax, imo.] [CODE] /* you can count these yourself, without using strlen(), if necessary */ lensub = strlen(substring); lenstr = strlen(string); for(i=0;i<(lenstr - lensub);i++) { j=0; …

Member Avatar for Adak
0
152
Member Avatar for SHENGTON

I'm confused. Linked lists can be done as a queue (a regular list or line), or as a stack (like a stack of plates). push and pop are used for stacks, and data is entered one at a time, at the top of the stack, only. lists use a FIFO …

Member Avatar for abhimanipal
0
113
Member Avatar for allynm

I have bind.exe, as part of Visual Studio C/C++ 6.0. It is in the C:\Program Files\Microsoft Visual Studio\Common\Tools directory. I looked at it with a hex editor, and neither I nor my AV program (scanned it twice), see any indications that it's a virus**. It says it binds an image …

Member Avatar for Ancient Dragon
0
179
Member Avatar for peck

fire up the IDE, and click on "Options" then "Directories". Check the listing for your header files. When you include the header file, be sure to add the < or " char's around the file name: #include <stdlib.h>. Works for default directory locations. "stdlib.h" works for limited searching for the …

Member Avatar for Adak
0
61
Member Avatar for poojabi

We just had a wonderful example of a binary search program in "Snippets" section of this forum, about two weeks ago.

Member Avatar for Adak
0
107
Member Avatar for dany12

The program uses nr_products and nr_prices, without having given them values! :( These variables were declared BUT NOT initialized to any value. if statements need TWO == in them, instead of just one =. You need a for loop (best) to control how many times a price needs to be …

Member Avatar for dany12
0
133
Member Avatar for challarao

Most compiler's have a default return type of int - like Borland used to. Today, you should be explicit about your return types, and they should be included in your function prototype. What is the return good for? Any answer to a computation the function is doing! Serious programming doesn't …

Member Avatar for challarao
0
2K
Member Avatar for boiishuvo

The answer is that scanf() leaves the newline char (which is generated when you hit the enter key), behind. To solve your problem, add a getchar() line of code, immediately below your scanf(), and all will be well, (unless you press other unnecessary keys). Now you know just a bit …

Member Avatar for Adak
0
133
Member Avatar for wantai

After each scanf(), add a getchar() to pull the left-behind newline char, off the keyboard buffer. Scanf() is fragile - it requires a clean input stream, and even then, it should be used for highly formatted input, only. fgets() is far more robust and flexible. Please use [CODE] tags around …

Member Avatar for Adak
0
102
Member Avatar for pdoratis

Welcome to the forum, Pdoratis! ;) The thing is, you NEED some experience with C, to work on a C program - that's the simple fact. We won't just do your assignment for you - especially important is for YOU to put some effort into the start of the job. …

Member Avatar for challarao
0
1K
Member Avatar for ciali

You need to highlight your code, then click on the [CODE] icon in the edit, which will post up two code tags for you. Paste your code, between those code tags. Otherwise, you code will be turned into html text and look really bad. And yes, as noted above, you …

Member Avatar for Adak
0
132
Member Avatar for snigger

Time is usually measured in C with two clock_t variables: [CODE] #include <time.h> #include <stdio.h> #include <dos.h> int main(void) { clock_t start, end; start = clock(); delay(200); //adjust as needed for your compiler and OS //sleep(200); //ditto end = clock(); printf("The time was: %f\n", (end - start) / CLK_TCK); return …

Member Avatar for Adak
0
2K
Member Avatar for jeevsmyd

Int return codes help answer the important question: I ran the program, but did it finish normally, throw an error, or get caught in an endless loop of some sort? By custom, a zero return indicates a successful program run. Other numbers might correspond to specific errors, and no return …

Member Avatar for gerard4143
0
142
Member Avatar for psionic

Vijay, you need to stop posting in an old thread - your post will be pretty much ignored and considered old as well. Or posters will answer Psionics questions, and not yours. :( Start a new thread, and be as specific as you can. Post the code that you're working …

Member Avatar for srinivasan106
0
365
Member Avatar for potato4610
Member Avatar for painejake

IMO, the best thing to do is Google one of the many C# tutorials on the web, and go through them first. THEN you'll be primed to start working through whatever problem you want to tackle. When you have NO idea of where to start - don't start - get …

Member Avatar for Adak
0
96
Member Avatar for daisuke

We would need two things to help you: 1) See your work starting this program and 2) Post the details of the program you need to make. "Receipt program" isn't nearly enough to know what you need the program to do. And Welcome to the Forum! ;)

Member Avatar for Adak
0
68
Member Avatar for farahlyna

I never give people the address to my house. I always give them a *copy* of the address to my house. They always find my house, with no problem. ;) When you post code, use CODE tags around your code - always.

Member Avatar for gerard4143
0
126
Member Avatar for creeps

Lots of problems with this code: 1) The logic is poor - an endless loop, then a break here, a break there, another break someplace else... Is this logic for a program, or a Chinese fire drill? ;) One break, maybe two, OK. Three? No. This is WAY too simple …

Member Avatar for Adak
0
331
Member Avatar for harikrishna439

In most cases, you don't want to shuffle data records around in a database. If you have 3,000 students in a school, and a 3,200 student array of structs to handle their records, whenever a student leaves the school, you don't shuffle a bunch of records down to compact the …

Member Avatar for Ancient Dragon
0
178
Member Avatar for unexpert

Two things: 1) Your logic for max is reversed. Use > max, not < max. [CODE] min=adc_result[0]; max=adc_result[0]; for(j=0;j<i;j++) { if(adc_result[j]<min) { min=adc_result[j]; } } for(k=0;k<i;k++) { if(adc_result[k]<max) //change the < to > { max=adc_result[k]; } } [/CODE] and 2) You only need one for loop for this, you can …

Member Avatar for Adak
0
149
Member Avatar for gahhon

Your for loop has a bad test to end the loop. x will always be greater or equal to zero, so the loop quickly is working outside the array. [CODE]for(x=0;x<strlen(title);x++)[/CODE] should work. It is more efficient to first, before the for loop, get the length of the string assigned to …

Member Avatar for gerard4143
0
235
Member Avatar for hari.sarvothama

In the second program, you have this bit of code: [CODE] char *a,*b; FILE *fp,*fp1; fp=fopen("int.txt","r"); fp1=fopen("obj.txt","w"); getsym_op(); while(1) { fscanf(fp,"%s",a); [/CODE] Looks to me like you're assigning a string to a, but a is a pointer (not an array as you've used before with the same name), and a …

Member Avatar for hari.sarvothama
0
2K
Member Avatar for gahhon

Use an if() with else if() series of statements. When Narue speaks, wise coder's listen. Get those ears cleaned out, dude. ;)

Member Avatar for Adak
0
178
Member Avatar for Danny_501

Defines are just stupid "find and replace" substitutions, made before the program starts, and that can lead to a LOT of problems that are hard to de-bug. A small function seems perfect for this.

Member Avatar for Danny_501
0
144

The End.