1,088 Posted Topics

Member Avatar for tquiva

[CODE]/* A program to count the number of grades occurring in the input */ #include <stdio.h> #define DEBUG int main() { /* Declare variables */ int a; int b; int c; int d; int f; int others; [COLOR="Red"]int ch; /* for input */[/COLOR] /* Initialize variables at zero */ a …

Member Avatar for WaltP
0
122
Member Avatar for lionaneesh

[QUOTE=lionaneesh;1167772]Exercise 1-9. Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank. help ME WID THIS .........[/QUOTE] What's wrong with `with'? It only takes one more character than `WID' to type, ... but then, you don't care about …

Member Avatar for Aia
0
179
Member Avatar for shetnok13

[B]shetnok13>[/B] I can't subtract the cost from the input of the user..[.] Logic dictates that you must know how much it cost the choice of beverage. After that you need the amount payed, supposedly it would have been entered into variable `b' (you wrote:[ICODE]scanf("%d",&b);[/ICODE]) then you compare to see if …

Member Avatar for Aia
0
179
Member Avatar for churni

[QUOTE=churni;1166145]hi, iwhen i call it again its adding the value to the previously displayed number unless i close the whole program down and start again. how do i reset the value each time i call the function. [/QUOTE] [ICODE][COLOR="Red"]static[/COLOR] int i=0;[/ICODE] The static keyword makes the i to retain the …

Member Avatar for churni
0
101
Member Avatar for sam_021

[QUOTE=sam_021;1166338]Hi basically i dont have time to do this coursework , due to overload of work .. it probably take like an hour for some1 who knows what they are doing .. ill pay like 15-20 quid ?[/QUOTE] most who post here dunno wut they're doin. and those that know …

Member Avatar for Aia
-3
33
Member Avatar for abhishekvarmag

[QUOTE=abhishekvarmag;1165746] ..............................plzz modify this[/QUOTE] Done! I deleted it!

Member Avatar for Aia
-3
792
Member Avatar for jephthah

[B]jephthah>[/B] And I would use both "strtok" to parse the strings between the separator characters I do not care about strtok() much. It doesn't work with read-only strings like the literal "this string", since it has to modify the given string to token it.

Member Avatar for Dave Sinkula
0
157
Member Avatar for TimCereja

jephthah> And I would use both "strtok" to parse the strings between the separator characters I do not care about strtok() much. It doesn't work with read-only strings like the literal "this string", since it has to modify the given string to token it.

Member Avatar for TimCereja
0
362
Member Avatar for churni

[CODE=c]/************bubble sort******************************************************/ void bubblesort ( int i){ int x,y,j; float temp; char buff[BUFSIZ]; float a[N]; FILE *in; in=fopen("rand.txt","r"); i=0; while(fgets(buff,BUFSIZ,in)!=NULL){ a[i]=atof(buff); i++; }[/CODE] Let me analyze the first fifteen lines. [ICODE]void bubblesort ( [COLOR="Red"]int i[/COLOR]){[/ICODE] That i parameter will become a copy of the argument, since you assign 0 to …

Member Avatar for churni
0
223
Member Avatar for lugan

[B]lugan>[/B] For the input i just want to use scanf(), and then it says that the Count function MUST use a getchar() to read one letter of the string at a time and go until ENTER or \n is pressed. There's a conflict as per the description. getchar() reads only …

Member Avatar for lugan
0
100
Member Avatar for bops

[CODE]int totalLen = strlen(formatstr) + strlen(name); [/CODE] I would try to avoid this kind of statements since the order of evaluation of the two functions is not defined. If one function affects the result of the other, then side effects will result. [CODE]char* buffer = (char*) malloc (sizeof(char) * totalLen); …

Member Avatar for Raptor007
0
1K
Member Avatar for Interesting_Hat
Member Avatar for stratsp
0
135
Member Avatar for DoEds

[QUOTE=shah1248;1148640]Please use gets() instead of scanf() if you expect spaces in the user input. scanf() does not handle spaces the way you want it to work.[/QUOTE] gets() is not an option, because there's no way of controlling how much data can be inputed. There's no way of using it safely. …

Member Avatar for DoEds
1
278
Member Avatar for shoby

Added comments where things are not right. Did not pay attention to logic of program. Need work on how to place {} correctly as a block. Need to work on usage of switch. Need to work calling functions. Need to work in proper formatting. [code=C]/* # include <iostream> This is …

Member Avatar for jmsDC
0
469
Member Avatar for blackrobe
Member Avatar for WaltP
0
178
Member Avatar for johndoe444

[QUOTE=johndoe444;1149251]Frequently we need to copy-paste a code snippet and compile-run it. The problem is that the lines of code are tagged by line number. So what utility to use to elegantly discard the line numbers?[/QUOTE] Your question is ambiguous at best. I might have to make some assumptions If you …

Member Avatar for Skifter
0
266
Member Avatar for kng

Consider this as a friendly warning. You will be ignore by those that can really help you if you don't use the proper C code tags when you post code. Example [URL="http://www.daniweb.com/forums/thread93280.html"]here[/URL].

Member Avatar for Salem
0
170
Member Avatar for habib_parisa

[QUOTE=Salem;1155929]8 posts, no code tags. You've got two more attempts to get your act together.[/QUOTE] Take it as a warning, but as a honor as well that you did not get completely ignored, for purposely ignoring the code of conduct of this forum.

Member Avatar for Salem
0
172
Member Avatar for dumbncool

A little [URL="http://www.tenouk.com/ModuleZ.html"]something[/URL] about memory

Member Avatar for dumbncool
0
169
Member Avatar for goodeye28

[QUOTE=goodeye28;1155279]anyone can help me?[/QUOTE] You are asking for help. However, what you want is different from help. You want someone to write the program for you. This forum is not for that.

Member Avatar for Aia
1
975
Member Avatar for lionaneesh

[CODE]condition = fgets(save,30,reading);[/CODE] fgets() returns a pointer to a string. condition is an int declare condition as such: [ICODE]char *condition;[/ICODE] [B]save[/B] is a buffer of 100, but you only use 29 + the nul terminator '\0' A better statement would be: [CODE]fgets( save, sizeof save, reading ); [/CODE] [ICODE]printf("[COLOR="Red"]\n[/COLOR]%s",save); [/ICODE] …

Member Avatar for Aia
0
130
Member Avatar for khess

>Sounds easy enough. Let me get right on that. Sarcasm statement that sets the note of the rest of the blog article. >I think Mark Shuttleworth should pay for it--seriously. He has the money. It's his idea. Let him shell out the bucks for it. Very typical of leeches' philosophy. …

Member Avatar for donkey_pasta
0
288
Member Avatar for tyke17

[QUOTE=strmstn;1151666]But it isn't necessary. prog.cpp will compile anyway.[/QUOTE] Of course, that it most likely will compile. Nevertheless, that will create a C++ program and not a C program. [B]Sad[/B] that what it should be obvious, it needs to be explained in just great detail.

Member Avatar for strmstn
0
97
Member Avatar for whoamineo89

Instead of using a printf() to display the random numbers, store them into an array of int.

Member Avatar for WaltP
0
120
Member Avatar for The Dude

> (For some reason my browser doesn't recognize the fact that this isn't a text file.) My browser also thinks is a text file.

Member Avatar for coloradoboy2
0
414
Member Avatar for nirav99

.c files do not get called in the shell to be interpreted, they need to be compiled, and then linked as part of a program.

Member Avatar for WaltP
0
72
Member Avatar for Aurorian

[QUOTE=Aurorian;1147817] Still not working correctly. Again I'm terribly sorry for this double or quadroople posting, but I'm not allowed to edit any previous posts.[/QUOTE] It is perfectly fine to post any updated code again. Once a post is summited there's only a forty-minutes window of opportunity for editing. [QUOTE=Aurorian;1147817] Never …

Member Avatar for Aurorian
0
200
Member Avatar for drewangel

If I tell you that it will reflect, would it make you brave enough to try to compile a piece of code for yourself?

Member Avatar for Salem
0
117
Member Avatar for akito1111

[QUOTE=MyrtleTurtle;1148419]That code works fine for me (in Dev-C++). No errors, no warnings.[/QUOTE] [QUOTE=akssps011;1148517]Worked perfectly on Codeblocks. Which compiler are you using ?[/QUOTE] Interesting. [CODE]printf("%06[COLOR="Red"]f[/COLOR]\t %5.2f\t %5.1f\t %5.1f\t %8.2f \n\n\n", [COLOR="Red"]clock[j][/COLOR], wage[j], hours[j], woOt, gross); [/CODE] It doesn't flag clock[j] as trying to convert an int to a float? It doesn't …

Member Avatar for Aia
0
383
Member Avatar for gerard4143

[QUOTE=gerard4143;1146775]Well I think this is the last version...I think or hope. I starting to get a love/hate relationship with shell scripting...its really something but I'm not really sure what...;) [/QUOTE] Are you giving up before achieving an one-liner? ;) A few points if I may. When making use of test, …

Member Avatar for gerard4143
0
402
Member Avatar for vijayr_singh

You missed to read about the forum posting [URL="http://www.daniweb.com/forums/thread78060.html"]expectations[/URL] and proper [URL="http://www.daniweb.com/forums/thread93280.html"]code tagging[/URL]. I suggest you stick around and learn why your posted code is not a good example.

Member Avatar for siriussam
-1
898
Member Avatar for donelliewhyte

[QUOTE=donelliewhyte;1145400]I am not really getting an error its just printing nothing[/QUOTE] This > [ICODE]while(number!=info.regis); [/ICODE]and this > [ICODE]if (info.regis!=number)[/ICODE] would work if they were int or float type, but it does not work as intended if they are array of chars. For that you can use strcmp() [ICODE]while ( strcmp(number, …

Member Avatar for WaltP
0
218
Member Avatar for donelliewhyte

...Hmm, I see it, I want to say; almost feel that.. Is there any variable in your life that has not been yet initialized?, something starting as ...name, or number or n, something with... that starts with n?. Yeap! I feel I have to validate that. Thank you for calling, …

Member Avatar for WaltP
0
78
Member Avatar for tquiva

[CODE][COLOR="Red"]input[/COLOR] = scanf("%f %d", &base, &exp);[/CODE] scanf() returns an int type, however input is of float type. Not that you use input for any reason. [CODE][COLOR="Red"]float pos_power[/COLOR](float base, int exponent)[/CODE] pos_power returns a float type, and [ICODE]result = pos_power(base, exp); [/ICODE] is expecting it, however you do not make any …

Member Avatar for anup375
0
109
Member Avatar for alma27534

[QUOTE=alma27534;1143091]The program compiles and this is the the output I get: ?Invalid number of arguments Press any key to continue . . . Can somebody please take a look at this program and give me some ideas? [/QUOTE] You must not be entering the right amount of parameters when running …

Member Avatar for alma27534
0
303
Member Avatar for lionaneesh

Here, this is a [URL="http://www.daniweb.com/forums/thread78060.html"]pointer[/URL]

Member Avatar for jonsca
0
169
Member Avatar for Stack Overflow

[CODE]lines = realloc(lines, (size += 1) * sizeof(char*));[/CODE] On realloc failure a new pointer is made pointing to NULL and the original block is lost and not freed.

Member Avatar for Ancient Dragon
0
2K
Member Avatar for funtoknow

[CODE=c]printf( "Enter sale amount $: " ); fflush( stdout ); /* because there's not newline at the end of printf string argument */ if ( scanf("%f", &fSale) ) /* scanf returns a positive int if successful, the if checks that */ { if ( fSale > 0.0 ) { printf( …

Member Avatar for pebbles
0
393
Member Avatar for sk8ndestroy14

Oh, no. I smell conspiracy plots. I can almost tested in the air. The Cubans, it was the Cubans. Castro send his assassins. ;) ...But Sir, the bullet says: Made in China.

Member Avatar for brandonyy4u
0
741
Member Avatar for Linux777

The problem is in how awk accepts an external variable, in this case $dat. [CODE]awk [COLOR="Red"]-v Var_date=$dat[/COLOR] '{if(( $5 > 200 ) && ( $6 == [COLOR="Red"]Var_date[/COLOR] )) [/CODE]

Member Avatar for Linux777
0
97
Member Avatar for Kombat

[QUOTE=Dave Sinkula;1125081]I think this code would be a great little test sample for "find the bugs". [I'm thinking of recent threads on the topic of code and job interview.] Maybe not all bugs, but "issues", "don't do this" things, etc.[/QUOTE] You are too kind with "Maybe not all bugs." Without …

Member Avatar for Kombat
0
152
Member Avatar for Stubaan

Stubaan> I do not know how to solve 3) - how do I write the confounded value I have read from input2.txt into the exactly correct position within time.txt? Let's get this last part first out of the way. You don't change it in place, you save it to a …

Member Avatar for Stubaan
0
5K
Member Avatar for rhoit

[CODE=bash]for songs in $(cat "~Desktop/1/list.txt"); do cp $songs NewSongs/; done [/CODE] The while loop is more appropriate for it. The for loop will need the $IFS (Internal Field Separator) modified. [CODE=bash]while read songs do cp "$songs" NewSongs/ done < ~Desktop/1/list.txt [/CODE]

Member Avatar for Aia
0
99
Member Avatar for phoenix69

Welcome to the forum. Your post would be appropriated if it is pertaining to C programming. As it stands we don't know until people download the attachment, and many do have apprehensions about doing so. You forgot to ask a question concerning where you are having problems. I would like …

Member Avatar for peter_budo
0
1K
Member Avatar for PetuniaRose

PetuniaRose> The function of presidents, governors and mayors is only to execute the will of the folks who elected them. No man/woman has discovered/devised a system that would prevent the genuine will/voice of the people to be manipulated, corrupted for political agendas. On the other hand, it is most likely …

Member Avatar for Ene Uran
0
969
Member Avatar for mindbender

[QUOTE=ramyasowbhagya;867911]try randomize function header file stdlib[/QUOTE] And why not use a [I]flux capacitor[/I]? Everyone knows that it will produce the [I]jiggawatts[/I] necessary to create a matrix. I get it now; it is the plutonium, isn't? @mindbender. Without showing a minimum of the effort you have putted into it, already, you …

Member Avatar for Nick Evan
1
5K
Member Avatar for Dokino

Dokino> Could you explain me this part [ICODE]print '%s is %.3fmm\n' % (x,mm)[/ICODE] print accepts a string with operants to be formatted. [B]'[COLOR="Red"]%s[/COLOR] is [COLOR="Red"]%.3[/COLOR]fmm\n'[/B] The first two % gets substituted by the variables x and mm respectively. %s tell print that it should be formatted as a string, %.3f …

Member Avatar for Dokino
0
130
Member Avatar for aswin_agarwal
Member Avatar for er.imran2006

[QUOTE=er.imran2006;1087000]Want to merge multiple text file items into a single text Please give code [/QUOTE] Please, read the forum rules. We do not give code. You show effort and we might help you (with suggestions) how to achieve your goal.

Member Avatar for peter_budo
0
104
Member Avatar for johndoe444

johndoe444> from where did this garbage values come from? From [ICODE]int id[NUMTHREADS];[/ICODE] that is not initialized.

Member Avatar for ithelp
0
99

The End.