Posts
 
Reputation
Joined
Last Seen
Ranked #633
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
83% Quality Score
Upvotes Received
20
Posts with Upvotes
18
Upvoting Members
14
Downvotes Received
4
Posts with Downvotes
4
Downvoting Members
3
11 Commented Posts
~129.48K People Reached
Favorite Forums
Favorite Tags

114 Posted Topics

Member Avatar for cse.avinash

[QUOTE]We have to use other testing for primality, and I believe cse.avinash has explored using the Sieve of Eratosthenes, which I take it were also unsuccessful. [/QUOTE]You guys should take a look at [URL="http://www.scriptol.com/programming/sieve.php#c"]this[/URL].The second one is much more powerful than the first one(I'm totally amazed by the results).

Member Avatar for vantrendin
1
6K
Member Avatar for mayankjoin

So , what's wrong with your program ? since we're not a psychic or in the mood of playing the"Guess what's wrong with my code" game, you have to tell us what exactly are you looking for.

Member Avatar for Niranjana_1
0
1K
Member Avatar for D33wakar
0
349
Member Avatar for D33wakar

This is a simple echo server that I've written while learning sockets programming. Compile the server and run it. You can connect to it using telnet like this: telnet localhost 1337 Disconnect the client by typing "/quit" without quotes.

0
388
Member Avatar for D33wakar

This is a simple hangman game that I wrote using my beginner python skills. Though this game is playable, there must be lots of things I must've been doing wrong or the methods I'm using here may be not so pythonic. So I want some suggestions on how to improve …

Member Avatar for TrustyTony
1
711
Member Avatar for MrNo

[QUOTE=MrNo;1704619][CODE]#include <stdio.h> #include <string.h> int main() { int count = 0; char *doc; FILE *inp; printf("Enter the file name: "); scanf("%s", doc); inp=fopen(doc, "r"); while((doc = fgetc(doc)) != EOF) { if (doc == ' ') count++; } fclose(doc); printf("%s contains %d words\n",doc,count); return 0; } [/CODE] So basically I'm a …

Member Avatar for zeroliken
0
318
Member Avatar for Lillylionhert

And here's how you use strtok (you know... for future references). [CODE]#include <stdio.h> #include <string.h> int main(void){ char line[20] = "Process0 12 1"; // suppose this is the first line read by fgets char* delim=" "; char* result = NULL; result=strtok(line,delim); if(result != NULL) printf("process:%s\n",result);//store process in an array result=strtok(NULL,delim);//first …

Member Avatar for Lillylionhert
0
5K
Member Avatar for D33wakar

If there's a list like below [CODE]s=['b','a','r','r','i','s','t','e','r'][/CODE] and if I tried to remove every 'r' from the list like this [CODE]>>> for x in s: if(x=='r'): s.remove(x)[/CODE] it gives the following result. [CODE]>>> s ['b', 'a', 'i', 's', 't', 'e', 'r'][/CODE] Why isn't the last 'r' removed from the list.

Member Avatar for D33wakar
0
103
Member Avatar for gizmo7008

[QUOTE]The program runs and compiles. When I enter the two words, it gives me a bunch of random stuff when printing[/QUOTE]That's because scanf is not used like this [CODE]scanf(x1,x2,MAXFORTHIS,stdin);[/CODE] [URL="http://en.wikipedia.org/wiki/Scanf"]click here[/URL]

Member Avatar for WaltP
0
926
Member Avatar for Master Mascus

[QUOTE]anyone can tell me what this line does?[/QUOTE]clearly, it's returning the uppercase of the character given to the function.The first return statement only works if the condition cl>='a'(i.e.97 in decimal) AND cl<='z'(i.e 122 in decimal).If it does so then the second return statement is not executed, but if it does …

Member Avatar for D33wakar
0
119
Member Avatar for Liuhh00

[QUOTE]The case choices does not run after the input of the integers 0 or 1.[/QUOTE] You're missing '&'before 'choice' in your 'scanf' statement . [CODE]scanf("%d",&choice);[/CODE] and another(important!) thing,look at this [CODE]int number, integer,choice; int ArrayN[20]; for(i=0;i<20;i++) { printf("Enter 20 Integers\n"); scanf("%d", &number); printf("ArrayN[%d]=%d\n",i,number);//well, that's stupid! }[/CODE] You have to assign …

Member Avatar for D33wakar
0
127
Member Avatar for Ich bin würdig

When you compile your 'C' code, an object file is generated by the compiler. Such object files from each program(from the collection of programs) are build into a single binary(executabe) file by another program called linker.

Member Avatar for Smeagel13
0
97
Member Avatar for The 42nd

[QUOTE]Can you tell me why use size_t and not int for orig_len and rep_len?[/QUOTE] Using size_t instead of just plain int or unsigned int makes your code more portable since the size of int types vary across platforms. Also the above standard functions expect their third argument to be of …

Member Avatar for The 42nd
0
313
Member Avatar for Daniel85

First of all, use code tags whenever you post any code.See that CODE thingy, click that and paste your well formatted code in between. There's no use of this `#include<conio.h> `in your code and why this `char studentanswer[30][30+1];` why not just declare it like this char studentanswer[30][31]; Since you're opening …

Member Avatar for Daniel85
0
165
Member Avatar for terence193

[ICODE]'fflush(stdout)'[/ICODE] forces the data (if any)in the I/O buffer to be written to the screen .Including a '\n' character(if suitable) in the [ICODE]'printf'[/ICODE] itself also does the same thing.[CODE]printf("incorrect value\n");[/CODE]Remember that [ICODE]fflush[/ICODE] is only used with output streams.Calling [ICODE]fflush[/ICODE] with [ICODE]NULL [/ICODE]argument flushes all the opened streams.

Member Avatar for YAMNA MIDHAT
0
202
Member Avatar for ram619

[QUOTE]This is a piece of code from some book.[/QUOTE]Is that [URL="http://www.daniweb.com/software-development/c/threads/389911/1679633#post1679633"]the same book[/URL] Narue told you to burn ? [CODE]int fun (const union employee *e); union employee { char name[15]; int age; float salary; };[/CODE]You should declare the union first and then the function 'fun'. [CODE]union employee{ char name[15]; int …

Member Avatar for ram619
0
195
Member Avatar for ahp@aol.in

The answer is in your error message [CODE]cc1: warnings being treated as errors test_cal.c: In function ‘calsum’: test_cal.c:20: error: control reaches end of non-void function[/CODE]Since function calsum is non-void(means returns something), so you should add a return statement. [CODE]return d;[/CODE]

Member Avatar for D33wakar
0
175
Member Avatar for DmytriE

It's a very , very messy code.Here are few things that I saw, that could be potentially causing the problem. 1.You have named many things "Information".First the struct for book data[CODE]/*Structure for book information */ typedef struct Information { char subject [MAXIMUM_TITLE]; char author [MAXIMUM_AUTHOR]; int edition; int year; float …

Member Avatar for D33wakar
0
114
Member Avatar for jtbens01

[QUOTE]The code compiles[/QUOTE]That totally amazes me.[QUOTE] but when I run the program it stops responding once it enters the while loop [/QUOTE]So there's a strong possibility that the problem lies on your while loop statement. [QUOTE][CODE] while (fgetc(inFile) != EOF) != NULL) {[/CODE][/QUOTE]'fgetc' returns EOF when read error occurs or …

Member Avatar for jtbens01
0
209
Member Avatar for thendrluca

[QUOTE][CODE]fflush(stdin); //clear the buffer???![/CODE][/QUOTE]Don't use [ICODE]'fflush'[/ICODE] with [ICODE]'stdin'[/ICODE],[URL="http://c-faq.com/stdio/stdinflush.html"]see why.[/URL]also [URL="http://c-faq.com/stdio/gets_flush2.html"]this[/URL]might be helpful. Either use [ICODE]getchar[/ICODE] after each call to [ICODE]scanf[/ICODE] to discard the '\n' from the input buffer or don't use scanf at all.There are [URL="http://docs.google.com/viewer?a=v&q=cache:V6IRXWslR5YJ:www.physics.ohio-state.edu/~ntg/780/handouts/interactive_input_in_C.pdf+how+to+take+inputs+interactively+in+c&hl=ne&gl=np&pid=bl&srcid=ADGEESiscFG8cYzt_lUxZk-m03JcLcXc46ILQ_roQLB6-39GuhhH1EHr_vn4eHVz6wZRzSOgJq3JkHiRbmJmOAM1OUT0mfpyZTeqn3qzq8dXgdXM5eUut8f1ddM-7LDs068yDWDu9lqq&sig=AHIEtbS9Sh6F_jZcWpfTiobG8o9XFEdAGg"]other solutions[/URL] for interactive inputs.

Member Avatar for thendrluca
0
339
Member Avatar for vinodhsml

Well, I compiled your code and entered the number 119 and it printed out: " not a prime Prime number" Do you need help or just mocking us? Can you explain the algorithm you're using for this?(only if you're willing to, there's no pressure)

Member Avatar for reojavier
-1
133
Member Avatar for ram619

What the ..? I mean, How the ...?[QUOTE]can anyone please tell me whats actually happening in this code. Seems to be as if incremented pointer is pointing to the next bit of same int.[/QUOTE] Why don't you try it in your compiler.did you?[QUOTE]Answer is 2,0[/QUOTE]So you did try it and …

Member Avatar for Narue
0
357
Member Avatar for VengefulToast

[QUOTE]Now, if anyone would be willing to assist me I would greatly appreciate it! [/QUOTE]I don't know what you need help with, since you have it all figured out.If you want us to write(or translate) your code for you, the forum rules wouldn't allow it. You have to use software …

Member Avatar for D33wakar
0
578
Member Avatar for whitech

you forgot to use '&' in your scanf statement. [CODE]scanf("%d",&n);[/CODE] but what's the point of this [CODE]for(m=1;m<n;m++) for(t=1;t<=m;t++) { n=m*t; printf("%d,%d",m,n); }[/CODE]

Member Avatar for cse.avinash
0
202
Member Avatar for mameemonster

[QUOTE]no. it is not the expression is wrong. but the program enter the input itself. blank input. and it direct tell to input the correct answer before i get to input anything.[/QUOTE]This is a very common problem.I hope [URL="http://c-faq.com/stdio/scanfc.html"]this[/URL] will make things clear. If not, try to Google it yourself.

Member Avatar for D33wakar
0
142
Member Avatar for mameemonster

just use [CODE]char* bus char* dest .../*and later*/ bus="single-decker" dest="taiping"[/CODE]

Member Avatar for mameemonster
0
114
Member Avatar for Liuhh00

[QUOTE][CODE]for(c_5=1; c_5<=10;c_5++) { for(c_6=c_5;c_6>=1;c_6--) printf(" "); for(c_6=10;c_6>=c_5;c_6--) printf("*"); printf("\n"); } printf("\n"); getch();[/CODE][/QUOTE] initialize c_5 to 0 instead of 1. [CODE]for(c_5=0; c_5<=10;c_5++)[/CODE]

Member Avatar for Liuhh00
0
134
Member Avatar for mkab

[QUOTE][CODE]int main( int argc, char **argv[] ) {//Wrong[/CODE][/QUOTE] [CODE]int main( int argc, char *argv[] ) {//right[/CODE]

Member Avatar for mkab
0
6K
Member Avatar for joshThtch

[QUOTE].for some reason sorting resets all entries to blank.Why is it doing that? I compare two entries, swap if necessary. Trying to figure out where that's failing.[/QUOTE]I compiled and ran your program, It works fine. In my opinion, in your 'DeleteEntry' function, try matching only the user's phone number, because …

Member Avatar for joshThtch
0
215
Member Avatar for Locke123

If you're using the variable val just to do this:[QUOTE][CODE]mov [val], ax add si,val[/CODE][/QUOTE]then there's no need to do so,just do it directly [CODE]add si,ax[/CODE] It's quite difficult to understand what you're trying to do, the information provided here is too little(not enough) and as far as your sample code …

Member Avatar for Locke123
0
212
Member Avatar for neveragn

[QUOTE]It shows the same prompt multiple times[/QUOTE]That's because the 'printf' statement is inside the loop and you don't need to pass that 'i'.You can do like this: [CODE]int main (void)//this is more readable, isn't it? { int n, smallest=0, i=0; printf ("Enter a list of positive integars:\n");//printf outside the loop …

Member Avatar for neveragn
0
257
Member Avatar for vedro-compota

[QUOTE=vedro-compota][CODE]if (!sizeof(stdin)) while (getchar() != '\n');[/CODE][/QUOTE][B]stdin[/B] is just a pointer to a [B]struct _iobuf[/B], so the [ICODE]sizeof(stdin)[/ICODE]will always return the size of a pointer variable(4 bytes). So your flushing mechanism [CODE] while (getchar() != '\n');[/CODE] won't even execute. [QUOTE=vedro-compota]- but this code 'll stop program when the input was empty …

Member Avatar for hkdani
0
6K
Member Avatar for minimi

[QUOTE][CODE]void print_triangle_info(int area(), int perimeter()); void print_square_info(int area(), int perimeter());[/CODE][/QUOTE] Are 'area' and 'perimeter' functions? If not, why give parentheses after them.the correct form of prototyping will be: [CODE]void print_triangle_info(int, int); void print_square_info(int,int);//takes two integers as arguments and return nothing(void)[/CODE] and then their definitions [CODE]void print_triangle_info(int area, int perimeter) {//no …

Member Avatar for D33wakar
0
153
Member Avatar for challarao

It's because of this line [CODE]int a[n];[/CODE] You cannot declare arrays like that. Here either 'n' should be initialized prior to declaring array [CODE]printf("Enter size:"); scanf("%d",&n); int a[n];[/CODE] or n should be replaced by some constant value. like this: [CODE] #define BUFFER 100 ... int a[BUFFER]; [/CODE]

Member Avatar for challarao
0
373
Member Avatar for MrNo

[QUOTE][CODE]#define EOF (-1)[/CODE][/QUOTE] You don't need to redefine EOF(already #[I]define[/I]d in "stdio.h"). [QUOTE][CODE]file = scanf("%d", &number);[/CODE][/QUOTE] You need to put this line in a loop to take consecutive inputs. [CODE]while((file = scanf("%d", &number)) == 1 && file!=EOF){ sum += number; sum_squares += number * number; ++n; }//repalces line 8 to …

Member Avatar for D33wakar
0
1K
Member Avatar for aero31aero

The only problem I'm seeing right now is the way you're passing filepath argument to fopen[CODE]file=fopen("E:\PROFILES.DAT","rb+");[/CODE] It should be like this: [CODE]file=fopen("E:\\PROFILES.DAT","rb+");[/CODE]

Member Avatar for aero31aero
0
254
Member Avatar for hugo17

[QUOTE=hugo17][CODE]int a,b; a = b;//[COLOR="Red"]bad practice[/COLOR][/CODE][/QUOTE] [QUOTE=hugo17][CODE]char c[2][2]; char d[3][3]; c = d;[/CODE][/QUOTE]Well?Why don't you try that in your compiler? the answer is no. you cannot do that with arrays. [QUOTE=hugo17][CODE]// or can you compare two arrays to get a true or false statement? if ( c == d)[/CODE][/QUOTE] Though …

Member Avatar for D33wakar
0
113
Member Avatar for phfilly

[QUOTE=Phillamon;1669659]Ola! I'm still kind of new with the whole assembly language and just need some help with this program i'm writing. What I want it to do is to ask a question -like for a number and then store that inserted number in a variable. And then test whether its …

Member Avatar for AceStryker
0
1K
Member Avatar for Se7Olutionyg

[QUOTE][CODE]#include <stdio.h> #include <string.h> #include <stdio.h> #include <stdlib.h> using namespace std; #include <iostream> [/CODE][/QUOTE]only need this one[CODE]#include <stdio.h>[/CODE] [QUOTE][CODE]if( sprintf (fileparam, "fall%d.dat", i) == true )[/CODE][/QUOTE] sprintf returns number of characters written(int) in the array 'fileparam' or a negative number if an error occurred not a Boolean. Your code when …

Member Avatar for D33wakar
0
190
Member Avatar for ragnacrap

You're opening the same file(handle) for reading and writing. [QUOTE][CODE]file = fopen (file2name, "r" );[/CODE][/QUOTE] it should be[CODE]write=fopen(file2name,"w")//"w" creates the file 'copy.txt' if it doesn't exist already[/CODE]

Member Avatar for D33wakar
0
248
Member Avatar for mameemonster

In addition, You can remove this line [CODE]#include <conio.h> //non- standard library,also not portable[/CODE] 'main' should always return int, like this:[CODE]int main(void)[/CODE] and return statement at the end.[CODE]return 0;[/CODE] add[CODE]fflush(stdout);[/CODE]after the printf statements,by doing that you'll force the output to be displayed on the screen even if the output buffer …

Member Avatar for WaltP
2
439
Member Avatar for DmytriE

[QUOTE]I now am having a problem entering values into the dynamic memory.[/QUOTE] It's not a good idea to ask for favors for every single problem you face. You should learn how to debug your own code at least. [QUOTE]Line 17-20 is a for loop to increment the variable 'i' so …

Member Avatar for DmytriE
0
120
Member Avatar for aFg3

You can do that like this: [CODE]setterm -bold on[/CODE]--> bold mode on [CODE]setterm -bold off[/CODE]-->bold off try:[CODE]man setterm[/CODE] or[CODE]info setterm[/CODE]for more information.

Member Avatar for cfajohnson
0
5K
Member Avatar for vedro-compota

Remove this line [QUOTE][CODE]int mainmenu();[/CODE][/QUOTE] from both 'main' and 'winmain'. and add a prototype of the function mainmenu at the beginning . [CODE]... int mainmenu(void); int main() ...[/CODE]

Member Avatar for vedro-compota
0
1K
Member Avatar for inagumi

[QUOTE=inagumi;1665066]Im using tasm xD In command prompt. what i mean is everytime i want to display it, it display the @,?,A,B,C etc. when the sum exceeds to 10,11,12,13,14 etc[/QUOTE] Instead of explaining what you meant, had you posted your code here, you may have already got the solution.

Member Avatar for inagumi
0
252
Member Avatar for annonymous21

[QUOTE=annonymous21]i found that if i do not add a newline char to the end of fprintf to stdout, it will hang. But if i add the \n it works...[/QUOTE] fprintf doesn't print the message until the output buffer is full. To make the prompt to be displayed immediately, you should …

Member Avatar for D33wakar
0
132
Member Avatar for yakovm

[QUOTE][CODE]fp = fopen("tmp","r");//in this line fd turns to be 0[/CODE][/QUOTE] I didn't see any fd, there. [QUOTE][CODE]freopen("tmp","w",stdout);[/CODE][/QUOTE] Wouldn't it be a good idea to save it's return value(i.e. file handle) somewhere else to use it later. [QUOTE][CODE]close(stdout);[/CODE][/QUOTE] 'Close' takes an integer representing filehandle to the opened file. [QUOTE][CODE]fgets(buf,100 , fp) …

Member Avatar for D33wakar
0
142
Member Avatar for Tenjune

[QUOTE=Tenjune]I'm testing this sample fast food chain program and my problem is every time I select the order the resulting price is like Php895764796364227741000000000000000.0000[/QUOTE] Your code is incomplete. You're trying to print the resulting price 'TP' without assigning any value to it. [CODE]printf("\nMay I take your order?\n"); scanf("%d", &choice); /* …

Member Avatar for YAMNA MIDHAT
0
115
Member Avatar for saravinuya

[QUOTE][CODE]void main(void)[/CODE][/QUOTE] 'main' should always return an 'int'(see [URL="http://www.daniweb.com/software-development/cpp/threads/337749"]here[/URL]or [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?id=1043284376&answer=1044841143"]here[/URL]or [URL="http://users.aber.ac.uk/auj/voidmain.shtml"]here[/URL],...the list will go "beyond infinity" ). It's better not to use labels and goto statements as they make your program's control flow hard to follow[QUOTE][CODE]goto add;[/CODE][/QUOTE](see [URL="http://c-faq.com/style/stylewars.html"]here[/URL]).Here in your case you can use 'continue' statement, it will do the …

Member Avatar for dev90
0
363
Member Avatar for vedro-compota

[QUOTE=vedro-compota]but what about point between words - it's feature of objective programming , but original c is functional language , isn't it? if "isn't" how can it be implemented without objective style? [/QUOTE] Well, WNDCLASS is a structure defined in 'windows.h' and the contents of a structure are accessed with …

Member Avatar for vedro-compota
0
337

The End.