15,551 Topics

Member Avatar for
Member Avatar for rithish

#include <stdio.h> #include<conio.h> #include<alloc.h> struct data { int value; struct data *next; }; int main() { int s; struct data *m,*i; printf("enter the data: "); scanf("%d",&s); i=(struct data *)malloc(size of(struct data); i->value=s; i->next=m; m=i; printf("enter the 2nd data: "); scanf("%d",&s); i=(struct data *)malloc(size of (struct data); i->value=s; i->next=m; m=i; printf("\n …

Member Avatar for deceptikon
0
250
Member Avatar for noahjer

Im trying to implement a program that will check the descriptions of two FA and check if they are equivalent. Im assuming (for simplicity) that each FA is in minimal form, the input alphabet is {a b} and each FA only has one finish state. Format for an FA is …

Member Avatar for deceptikon
0
110
Member Avatar for rhowell

I'm working with some old code and the users tell me that the original program's output was a single binary file containing multiple stuct data. The output I get is a binary file containing a single structure. The comment also indicates that this what is happening but I need to …

Member Avatar for poornamoksha
0
234
Member Avatar for nitin1

hey, i want to do a question in which i am given n line segments and i want to find the number of intersection of them. Can anyone tell me the most efficient way i can do it ? I have got some links on google and also from books …

Member Avatar for rithish
0
89
Member Avatar for binaryjc

SOLENN AND HER SUITORS Solenn has many suitors. To pick a partner, she has the following criteria: her partner's height and weight must be close to hers. Her suitors also want to know how many suitors ranked ahead of them (maybe they want to "get rid" of the other suitors?). …

Member Avatar for binaryjc
-1
171
Member Avatar for kgal

I want to write a program that does the following: reads and integer matrix from stdin and outputs the input matrix, its transpose and multiplication of the input matrix with its transpose. I limited the matrix to a 10x10. I want to ask the user to enter a number of …

Member Avatar for kgal
0
115
Member Avatar for romiaujla

I was trying to understand how BITWISE OR works in C, and while looking on the web I found an explanation on msdn http://msdn.microsoft.com/en-us/library/17zwb64t.aspx But there I found this short i = 0xAB00; And I really don't know what this code does. I saw it for the first time and …

Member Avatar for nmaillet
0
188
Member Avatar for shanki himanshu
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> int main() { int i,n,a=0,b=0,sum=0; printf("enter the limit of amstrong number: "); scanf("%d",n); for(i=1;i<=n;i++) { a=i; while(a>0) { b=n%10; sum=sum+ b*b*b; a=a/10; } if(sum==i) { printf("%d",sum); } } return 0; } it prints no errors but doest not work properly

Member Avatar for Gonbe
0
189
Member Avatar for somjit{}

i was watching [this video](http://www.youtube.com/watch?v=jTSvthW34GU&list=EC9D558D49CA734A02&index=2&feature=plpp_video) about type conversion and what the compiler does while converting from small byte formats to large byte formats(and vice versa) etc etc, and tried to write a code for it... but seems that function calls in my code are getting completely bypassed... once again, here …

Member Avatar for somjit{}
0
412
Member Avatar for hg_fs2002

When we define a variable name using #define in macro like: #define BUFFER_SIZE buff 5, and then in our main function declare a variable which has the same name like: int buff=8, Does the second buff overwrite the first one? I mean generally is a macro definition considered related to …

Member Avatar for deceptikon
0
216
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> int main() { int a=0,b=1,c=1,d=0,e=0,x,n; printf("enter the limit: "); scanf("%d",&n); while(d<=n) { d=a+b+c; a=b; b=c; c=d; e=a+b+c; for(x=d+1;x<d;x++) { if(x<=n) { printf("the non tribonacci series is: "); printf("\n %d",x); } } } return 0; } actually how to do this it doesnot print the values

Member Avatar for WaltP
0
149
Member Avatar for blaisemcrowly

Hi guys I been programming in c++ for past 2 years and is fairly good with it. First of all I dont need the code or anything but need some resources which i can use to get the basic idea so I can start developing. Had been googling for the …

Member Avatar for rubberman
0
1K
Member Avatar for mharks.newton

#include<stdio.h> #include<math.h> void getColorCode(char colorCode[]); long getResistorValue(char colorCode[]); int i,ch; long r_value=0; char ans; char j; char code; char colorCode[3]; int colorValue[3]; int main (void) { /* clrscr(); printf("\n\t\t\t\tRESISTANCE CALCULATOR"); printf("\n\t\t\t\t"); for(i=1;i<11;i++) { delay(10000); printf("*"); }*/ printf("\n1. START"); printf("\n2. QUIT"); printf("\nEnter your Choice(1-2):"); scanf("%d",&ch); clrscr(); switch(ch) { case 1: printf("*****************************************************\n\n"); …

Member Avatar for Ancient Dragon
0
198
Member Avatar for nitin1

http://www.spoj.pl/problems/FP/ here is the link. Can anyone please give me the hint only that how greedy approach is following in this question ? It's strange to see how greedy is there in this question. just the hint of this. no code, nothing! thanks.

Member Avatar for Adak
0
129
Member Avatar for porkchop7

I am making this two player simple game. I just need to make each of the player press a key any time not alternating from one another. Do I still use getch() for a solution? I have tried but the user still presses his/her assigned keys after the other presses …

Member Avatar for Ancient Dragon
0
90
Member Avatar for WaltP
Member Avatar for alaa sam

hi everyone well I'm learning network programming currently , I've written a day time client and server but when I run the client it gives me a connection error . Here is my client code #include<sys/socket.h> #include<sys/types.h> #include<stdio.h> #include<netinet/in.h> #include<netdb.h> int main(int argc ,char *argv[]) { int sockfd, n; char …

Member Avatar for alaa sam
0
99
Member Avatar for niyasc

Following is my code for reading from a file. #include<stdio.h> int main() { char s[10][10]; int i=0,j=0; FILE *ptr=fopen("input.txt","r"); char c; while(fscanf(ptr,"%c",&c)!=EOF) { if(c=='\n') { s[i][j]=0; i++; j=0; } else { s[i][j]=c; j++; } } s[i][j]=0; fclose(ptr); for(j=0;j<i;j++) printf("%s\n",s[j]); return 1; } and content of input.txt is A->XAZ|Yz|z X->xZ|x Z->Xz …

Member Avatar for niyasc
0
200
Member Avatar for omkar_hande

If a child process encounters exit(0) statement, where is this exit status returned in the parent process? Is there any variable associated with every process that holds this information? If not, how do children and parent processes communicate?

Member Avatar for poornamoksha
0
282
Member Avatar for dasdsaasd
Member Avatar for nitin1

#include<stdio.h> #define MOD 100000009 #define REP(i, n) for(i = 0; i < n; ++i) void mul(int a[2][2],int b[2][2]) { int i,j,k; int c[2][2]; for(i=0;i<2;i++) { for(j=0;j<2;j++) { c[i][j]=0; for(k=0;k<2;k++) { c[i][j]+=(a[i][k]*b[k][j]); } } } // matrix multiply i=0;j=0; REP(i,2) REP(j,2) b[i][j]=c[i][j]; // copying the value in back to b[][] return; …

Member Avatar for deceptikon
0
132
Member Avatar for shanki himanshu

where is union required? please explain with an example where having union is a better choice than any data structure.

Member Avatar for deceptikon
0
125
Member Avatar for AlexSmith069

i am writing this code for a school poject it gives mee segmentation fault .please help it scans iput of the form #include<stdio.h> #include<stdlib.h> struct time{ int hh,mm; }; struct date{ int day,month,year; }; struct student{ char firstname[20]; char lastname[20]; struct time entry; struct time leavetime; struct date dt; int …

Member Avatar for owenransen
0
117
Member Avatar for somjit{}

# code to convert any base input to any base output (base limited upto hexadecimal) # ## scanf() works , but gets() stops working from 2nd iteration ## *i apolozise beforehand for the length of this post, i hope there will be someone who'll bear with me :(* **here is …

Member Avatar for WaltP
0
391
Member Avatar for nitin1

#include<stdio.h> int main() { char a[60][60],b[60][60],i=0,n1,m1,n2,m2; int x,y; int j=0; char c; int p=-1,q=-1,f=-1,g=-1; scanf("%d%d",&n1,&m1); for(i=1;i<=n1;i++) scanf(" %s",a[i]); scanf("%d%d",&n2,&m2); for(i=1;i<=n2;i++) scanf(" %s",b[i]); for(i=1;i<=n1;i++) { for(j=1;j<=m1;j++) { if(a[i][j]=='1') { p=i; q=j; break; } } if(p>0 || q>0) break; } for(i=1;i<=n2;i++) { for(j=1;j<=m2;j++) { if(b[i][j]=='1') { f=i; g=j; break; } } if(g!=-1 …

Member Avatar for np complete
0
129
Member Avatar for Iamateur

The program is this : Write a program which takes 10 integer numbers from user. Save all the positive numbers to one file, all the negative numbersto another file. So,the coding will be compare all integers with 0 and save according in two different files right? If I am right …

Member Avatar for Iamateur
0
137
Member Avatar for Izslahi

I'm trying to compile a program where i am using the libraries studio.h, math.h and conio.h when I try to use the gcc comand it says that conio.h " not such file or directory"

Member Avatar for Izslahi
0
144
Member Avatar for somjit{}

this is a code from the book "the C programming language" by dennis ritchie, but for some reason its not working! #include <stdio.h> #define IN 1 /* inside a word */ #define OUT 0 /* outside a word */ /* count lines, words, and characters in input */ main() { …

Member Avatar for WaltP
0
198
Member Avatar for enakta13

#include<stdio.h> #include<conio.h> main() { int a[5],priority[5],adj[5][5]={0},i,j,k; a[0]=3; a[1]=4; a[2]=5; a[3]=7; a[4]=10; adj[0][1]=1; adj[0][2]=1; adj[0][3]=1; adj[1][0]=1; adj[2][0]=1; adj[2][4]=1; adj[3][0]=1; adj[4][2]=1; /* the ads[4][4] represents the linking edges adj[4][4]= 0 1 1 1 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 …

Member Avatar for TrustyTony
0
160

The End.