15,551 Topics

Member Avatar for
Member Avatar for nitin1

x^2 + S(x)*x - n=0 where n can be till 10^8 interger . and s(x) is the sum of the digits of the x integer. we have to print the value of x for which this equation holds otherwise print -1. my answer is taking too much time with brute …

Member Avatar for Gonbe
0
123
Member Avatar for porkie.mcpork

Hi all, Requirement: - I have a perl script that I need to run for several hours, for a performance test. - I would like to create a second script in ANSI C to call the perl script. The C script should be able to parse any of the text …

Member Avatar for porkie.mcpork
0
267
Member Avatar for creck

Hi guys, I am a novice in C programming, and would like to ask you for help as I've started studying a computer science at university just few weeks ago. All I need to do is write a math function "pow(double x, double y)" without using any of functions in …

Member Avatar for creck
1
298
Member Avatar for ayushcr7

Help me out pls...i dont understand why am i getting sigsegv error for many of my problems on spoj.This is one of them: http://ideone.com/B7KFW http://www.spoj.pl/problems/COINS/ I mean i know that i am accessing data outside the array but where?

Member Avatar for nitin1
0
102
Member Avatar for ronnel09_1

#include<stdio.h> #include<conio.h> void main() { int a[20],i; clrscr(); printf("enter 20 numbers: "); for(i=0;i<20;i++) scanf("%d",&a[i]); for(i=0;i<20;i++) printf("%d\n",a[i]); getch(); }

Member Avatar for Adak
0
224
Member Avatar for prince26121991

I just want to enter of 5 students data in structure but this loop is not running. pls help me out #include<stdio.h> #include<conio.h> #include<string.h> struct student { char name[20]; int age; float marks; } a[5]; main() { int i; clrscr(); for(i=0; i<5; i++) { printf("Enter the name of student"); gets(a[i].name); …

Member Avatar for prince26121991
0
117
Member Avatar for noahjonesnoah

Im curious if anyone knows if its possible to write a program to generate a regular expression given a finite automation. To make things less complicated I want to limit the number of states to about 4, assume the FA is in minimal form and that the FA has only …

Member Avatar for Gonbe
0
288
Member Avatar for dontyoufeelmywrath

Mind guys if you could help me on creating this program(regards with file handling). starting with this: for instance. i have a .txt file that contains these: lexeme token main - Identifier ( - Open Parenthesis ) - Close Parenthesis { - Open Curly Bracket printf - Keyword ( - …

Member Avatar for deceptikon
0
142
Member Avatar for glenndr_15

Greetings! Just want to ask how to create a C/C++ ide then link to a compiler? any advice? can I use a visual studio for creating an IDE?... Thanks Best regards, glenndr_15

Member Avatar for glenndr_15
0
346
Member Avatar for rithish

actually in infix or prefix expressions how does operators have high precdence than the other. for example + has high precedence than *.do they compare with ascii value of operator

Member Avatar for Gonbe
0
172
Member Avatar for ElDuderino12

#include <stdio.h> #include <stdlib.h> #define MAXSIZE 6 int main(int argc, char** argv) { float stddeviation, deviation, sumsqr, variance, mean, x, t, m, sum=0, max, min; int numdatapts, k; FILE * inFile; inFile = fopen("Uniform93.data", "r"); if(inFile == NULL){ printf("\nError opening file. Abort program.\n"); exit(1); } for (k = 1; k …

Member Avatar for Gonbe
0
1K
Member Avatar for songseungun

Hi. I'm having problems about my program. My program is something like a directory. It takes in values for different fields and stores it in a linked list in a sorted manner. It also allows the user to save the linked list contents to a text file. Everything runs okay …

Member Avatar for songseungun
0
865
Member Avatar for Grandiago

Hi. I'm new in programing and i have this program that i'm working on right now. it's still a working progress. but when i run it and choose from the options. the program kept moving upwards. like it looses the top part of the border. like this one: http://imageshack.us/photo/my-images/507/123sb.png/ this …

Member Avatar for Grandiago
0
153
Member Avatar for Dáni

helle there. I need a help in generate random 2D matrix !! How to write that plz !

Member Avatar for Ancient Dragon
0
234
Member Avatar for rithish

hello iam trying a circular queue in linked list and array there are two questions for me 1.how can circular queue can be implemented in a normal linked list??i think it can be implemented in circular singly linked list right?? 2.if i implement it in array how i will connect …

Member Avatar for WaltP
0
140
Member Avatar for BoulderMen

I am trying to write a funtion to print the contents of a queue using ADT funtions. I composed the following code. It gives me a error of invalid type argument. Need help. int print_queue(QUEUE *queue) { int tempCount; int inputVal; while ((queue_count(queue)) != 0) { tempCount = queue_count(queue); queue_front(queue, …

Member Avatar for BoulderMen
0
157
Member Avatar for code_r

I'm trying to read from a text file and have any multiple whitespaces between characters become one whitespace. If this how I do it using an array, #include <stdio.h> //Function prototype void modifyspace(char *dest, char *src); int main() { /* Initialize an array of 2000 characters */ char src[2000] = …

Member Avatar for code_r
0
250
Member Avatar for hakibam

I modify this .cpp code into .c but it gives error: the original code is:(runs fine) [CODE]#include <string> #include <iostream> #include <stdlib.h> using namespace std; int main() { int c, s[10]; int i, j; string name; cout << "Welcome to Airline Reservations System!\n"; for (j=0; j<10; j++) { cout << …

Member Avatar for Abin Jossy
0
2K
Member Avatar for revelator

Hi friends, i am doing a basic menu based Car rental system in C. i have a doubt regarding switch... do C permit us to use multiple switch case? or a Case within a Case??

Member Avatar for revelator
0
201
Member Avatar for nitin1

#include<stdio.h> #define num 10000000 int a[10000009]={0}; void sieve() { int i,j; for(i=2;i<=3164;i++) //loop till sqrt of largest number 10^7 { if(a[i]==0) // all primes are marked 0 { for(j=i*i;j<=num;j+=i) { if(a[j]==0) a[j]=i; // if i is prime then all it's multiples pos have value of i } } } return; …

Member Avatar for TrustyTony
0
214
Member Avatar for nitin1

here is a DP problem which i am solving from 2 days now. and i am finding a damn difficult. can you please tell what is overlaaping subproblem and what is optimal substructure in this problem. then i will try it again. any help will be appreciated. thanks http://www.spoj.pl/problems/GNYR09F/ thanks

Member Avatar for Gonbe
0
174
Member Avatar for Petranilla

Hi Everyone, Im' new in C. I was tasked to do a word game. Its a Guess a word game. The user inputs the letter through arrow keys. Then, my program supposed to check if each letter is correct. Then, display it in boxes. The problem is I cannot validate …

Member Avatar for Petranilla
0
243
Member Avatar for Petranilla

I'm a novice in C. I would like to ask the ff: 1. what is the return value of strstr function? 2. Is there a substring function in Turbo C where you specify the string, the length of string to extract and the starting position? 3. For instance, I have …

Member Avatar for WaltP
0
167
Member Avatar for hyung101

hmm..i'm doing something like a simple registration.. the user will input the information being asked, then those info will be stored into an array..are spaces not allowed to be stored in an array..? well, i can't explain the problem that much.. here's my simple code: #include <stdio.h> int i; char …

Member Avatar for WaltP
0
300
Member Avatar for salakgocap

Hi, Just wondering if anyone have a good source to read about getting an input from a file. for example: rather typing on the command prompt, i prefer to store all my command on .txt file. and using a single command to read what inside the .txt file and run …

Member Avatar for WaltP
0
157
Member Avatar for straylight

I am attempting to reverse a string for a homework assignment and then reverse each word in the string. The trick is we are suppose to code it without using functions. Like "I like cats" should be 1st "stac ekil I" and then "cats like I". Here is what I …

Member Avatar for rithish
0
1K
Member Avatar for Brigadier

Hi Everyone, I have been stumped by this problem. I need to create a pattern such as: 1 21 221 2221 22221 Using nested for loops. I have something that does (A) 222221 222221 222221 222221 222221 and used to have something that did (B) 1 21 221 2221 22221 …

Member Avatar for Adak
0
114
Member Avatar for prakhs

#include <stdio.h> #include <malloc.h> struct node { int data; struct node *link; }; void append (int data, struct node **s) { struct node *p, *q; if (*s == NULL) { p = (struct node *) malloc (sizeof (struct node)); p->data = data; p->link = NULL; *s = p; return; } …

Member Avatar for deceptikon
0
140
Member Avatar for jnewman3

I've been working on this code for 2 days now and i finally think i got the while loop running correctly but now i cant seem to print the child process id's. The code starts with the parent process forking 3 child processes. Then the parent must wait till a …

Member Avatar for rubberman
0
271
Member Avatar for Some Dude

So basically I am new to API programming and teaching myself. I've done a bit of console C++ that I got off of.... an internet tutorial. The story is the same here too. I am somewhat aware of what the lines of code do, though I am not yet a …

Member Avatar for neithan
0
310

The End.