- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 19
- Posts with Upvotes
- 17
- Upvoting Members
- 13
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 3
Hello every one Can I have a better algorithm to find the nth prime number, where 1<= n <=5000000. for e.g., 1st prime number is 2. 10th prime number is 29. 100th prime number is 541. 1000th prime number is 7919. 10000th prime number is 104729. 100000th prime number is … |
|
A complete C implementation of Linked List...tested on Linux GCC |
|
Similar to echoserver, but this one handles multiple clients by forking the process. |
|
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. |
|
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 … |
|
[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 … |
|
I am working on a Priority Based Scheduler which reads the process in from a file. I have it reading from file and printing to the screen. I'm trying to use strtok to tokenize a line from the process test file and store it in three different arrays. The layout … |
|
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. |
|
I am trying to find the longest common prefix of two words entered by the user. I don't understand what is going wrong. I keep getting this error when I compile: [CODE]prefix.c:11:13: error: expected declaration specifiers or '...' before '(' token [/CODE] And this is my code: [CODE]#include <stdio.h> #include … |
|
anyone can tell me what this line does? [CODE]return ('A' + c1 - 'a'); [/CODE] its in this function.. [CODE]char LToU(char c1) { if ((c1 >= 'a') && (c1 <= 'z')) return ('A' + c1 - 'a'); return(c1); } [/CODE] |
|
hey everyone on Daniweb, I'm liuhh00 in need of some dire suggestions for my program. I can't seem to solve why my program is not working right after i select my choice for case. The program is suppose to accept any 20 random integers, store them and allow the user … |
|
Does someone know how to integrate a collection of programs as one whole program? Thanks. :) |
|
Hello to all. I have a problem with replacing a part of a string with another string. The following code does not work. However, if you remove void in front of replace_str, in Code Blocks i am able to run it (WHY???) despite the fact that i still get a … |
|
***I have a feeling that there might be something wrong with my function int fgetAnswers(int*pos, char res[], FILE*inp); I am able to compile, but the problem is that wherever the black screen appears, a box would pop out saying that the program has stopped working. Can any of you guys … |
|
This is what the question is asking: Write a program to get the user to enter a positive number. Validate the input so any negative or zero number entered is rejected and the user is to re-enter the number. and this is what i have done [CODE]#include<stdio.h> int main (void) … |
|
This is a piece of code from some book. According to book, this code must not have worked and should have given a error message saying "cannot convert parameter 1 from 'const char[15]' to 'char*'" but this code is running on turbo C giving just a error message of const … |
|
Hi folks, I'm trying following code.. [CODE] #include<stdio.h> int calsum(int a,int b,int c); int main(){ int x,y,z,sum=0; printf("Enter the 3 numbers:\n"); scanf("%d%d%d",&x,&y,&z); sum=calsum(x,y,z); printf("The vlaue of sum is :%d\n",sum); return 0; } int calsum(int a,int b,int c){ int d=0; printf("The value of d is:%d",d); d=a+b+c; } [/CODE] ** (1) ** … |
|
Hi all! I am having trouble accessing dynamic information. I have used the malloc command to allocate the necessary memory for my struct. However, when I leave that function and enter a display function it says there is a problem accessing the information in the struct. I just had a … |
|
|
I've searched google and tried several different things but I can't figure out how to read strings into a two dimensional character array and also read doubles into separate arrays all from the same text file. Please provide any help you can and let me know how you might accomplish … |
|
This is my first post on daniweb :) and i am a beginner in C programming and i don't know so good english :) sorry! This is my program My problem consist of I run the program and i can't get to the [B]scanf("%c",&q);[/B] [I]/* Row 21 after printf. */[/I], … |
[CODE]#include<stdio.h> #include<conio.h> //header file declaring void main() { int a,i; clrscr(); printf("\n Enter the Number:"); //get value scanf("%d",&a); if(a%2==0) { printf("\n Not prime number"); } else { for(i=3; i<a; i=i+2) { if(a%i==0) { printf("\n Not a prime"); break; } } printf("\n Prime number"); } getch(); } [/CODE] |
|
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. Answer is 2,0 Thanks in advance [code=c] #include<stdio.h> #include<conio.h> void main() { int arr[3]={2,3,4}; char *p; p=arr; p(char*)((int *)(p)); printf("%d",*p); p=(int*)(p+1); printf("%d",*p); getch(); … |
|
Hey forum, our professor assigned us a program we have to write in assembly language and I would love to have help on it. [QUOTE]Write an upper-to-lower case and lower-to-upper case conversion program. When the user inputs a letter, your program should convert it to upper case if it is … |
|
i have to find proper divisors of a positive integer.for instance,the proper divisor of 15 are 1,3,5. input 15 output 1 3 5 like that. Thank you for your helps. |
|
hi. this is my program for bus ticket detail. at the bottom of my program, i want user to input yes or no for loop this program. but before i can input anything, it already told me that 'Please input the correct answer'. it is like i already input something. … |
|
hello. i have a problem in selecting destination and time. when i select any number in destination the program always tell me that i choose number 1 (taiping). and the time it always show 1030 even i input number that is not 1. please tell me where i'm wrong here. … |
|
hey guys lol i spent 5 hrs thinking about building this asterick pattern and i am still getting troubled by the spacing for the 3rd pattern , anyone can help me to reduce 1 spacing so the 3rd pattern isn't out of place?XD [CODE]#include <stdio.h> int main() { int c,c_2,c_3,c_4,c_5,c_6,c_7,c_8; … |
|
Hello everyone. I'm trying to code the cd shell command in c. I used chdir function to code it but the problem is that when I execute the program on the terminal it doesn't change the directory. I kept a series printfs and conditions to test if it changes, though … |
|
Building a phonebook program for school--very much a work in progress. I still need to write a sort function, tweak my delete function, etc. But actually what I'm hoping you folks could answer is hopefully simpler--for some reason I seem to have a while loop that is executing twice, and … |
|
I have a subroutine that is passed a pointer to a bit string in the si reg and an index in the ax register. I declared the val variable in the data seg [CODE]getbit: cmp ax, 1783 ; max value of the index being passed ja goback push si mov … |