15,551 Topics
| |
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 … | |
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 … | |
| 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 … |
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? | |
#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(); } | |
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); … | |
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 … | |
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 ( - … | |
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 | |
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 | |
#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 … | |
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 … | |
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 … | |
helle there. I need a help in generate random 2D matrix !! How to write that plz ! | |
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 … | |
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, … | |
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] = … | |
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 << … | |
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?? | |
#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; … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
#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; } … | |
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 … | |
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 … |
The End.