15,550 Topics

Member Avatar for
Member Avatar for Gaiety

I have executed the below program several times, most of the time i got the same out put but some times output is different. sample out put is: > skylab@skylab:~/Nx/Thrds$ gcc 3.c -lpthread > skylab@skylab:~/Nx/Thrds$ ./a.out > Scheduling policy = ??? > arg = 20 > 1arg = 20 > …

Member Avatar for Gaiety
0
211
Member Avatar for shanki himanshu
Member Avatar for Ancient Dragon
0
133
Member Avatar for rithish

i have a doubt how can we use string in matrices for examples a[0][0]=rohinn a[0][1]=rithish how to do this????

Member Avatar for zeroliken
0
586
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> main() { char a[30],b[30]; int i,j,n; printf("enter the limit: "); scanf("%d",&n); printf("enter the string: "); for(i=0;i<n;i++) { scanf("%s",a[i]); } j=strlen(a[0]); printf("%d",j); } here for example it will take 4 words where a[0]=word1,a[1]=word2,a[2]=word3,a[3]=word4 where i have particularly find string length of a[0] in 15 th line i …

Member Avatar for zeroliken
0
212
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { int i,j,n,c[10]; char *str,ch; str=(char*)malloc(20); printf("enter the string: "); fgets(str,sizeof(str),stdin); n=strlen(str); printf("%d",n); j=1; c[1]=0; for(i=0;i<n;i++) { ch=tolower(str[i]); if(ch== '') { j++; c[j]=0; } if(ch=='a'||ch='e'||ch='i'||ch=='o'||ch=='u') c[j]++; } printf("no of vowels in each word in given line is \n"); for(i=1;i<=j;i++) { printf("word is %d-->%d\n",i,c[i]); } …

Member Avatar for deceptikon
0
147
Member Avatar for shankarz

Look into this code: #include <stdio.h> main() { int p,n,r; float si; scanf("%d %d %d", &p, &n, &r); si=p*n*r/100; printf("SI = %f", si); } Output of this program is 100 100 100 SI = 169.00000 **and also this:** #include <stdio.h> main( ) { int p, n ; float r, si …

Member Avatar for I_m_rude
0
151
Member Avatar for vegaseat

You have to mildly trick Windows, but it is possible to put a bitmap image on your console. Uses a flock of WinApi calls. Works well with the free PellesC compiler and Dev-C++. This is a Windows Console Application. Drop me a comment, if you have luck with another compiler.

Member Avatar for I_m_rude
2
10K
Member Avatar for techy23

well, i want to learn some very basic game programming starting from C ,then C++.. How to include that header file <graphics.h> in my IDE like Turbo C or andy other IDE. please help! regards, Techy23.

Member Avatar for I_m_rude
0
1K
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { int i,j,d=0,k; char a[30],b; printf("enter the string: "); fgets(a,sizeof(a),stdin); printf("enter the first character to be searched and printed: "); scanf("%c",b); for(i=0;a[i]!=32;i++) { if(b==a[i]) { printf("%c",a[i]); } } for(i=0;a[i]!='\0';i++) { if(a[i]==32) { i++; k=i; if(b==a[i]) { for(k=i;a[k]!==32;k++) { printf("%c",a[k]); } } } } } …

Member Avatar for I_m_rude
0
145
Member Avatar for newbie14

Dear All, We are capturing each network packet which is in this format. The problem is that we would like to get the url if it exist in the packet in the form of http://...... ? What is the best whaay to interpret it to capture the url? 000000 cf …

Member Avatar for newbie14
0
173
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { char s[40]; int i,j,k=0,c=0; printf("enter the string: "); fgets(s,sizeof(s),stdin); for(i=0;s[i]!='\0';i++) { if(s[i]==32) { c++; } } if(c%2==0) { printf("there is no middle word"); } else{ j=c/2; for(i=0;s[i]!='\0';i++) { if(s[i]==32) { k++; if(j==k) { i++; while(s[i]!=32) { printf("%c",s[i]); i++; } } } } } …

Member Avatar for zeroliken
-1
164
Member Avatar for rithish

we are using printf and scanf from #include<stdio.h> libraray functions.is it possible to write our own display statement and input statement

Member Avatar for rithish
0
377
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> #include<ctype.h> void main() { char str[50]; int i=0; printf("enter the string: "); fgets(str,sizeof(str),stdin); printf("the abbrevation of string is"); printf("%c",toupper(str[i])); for(i=0;str[i]!='\0';i++) { if(str[i]== '') { i++; printf("%c",toupper(str[i])); } } } error at line 14

Member Avatar for rithish
0
131
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { char str[30],str1[30],str2[50]; int i,n,j,k; printf("enter the string: "); fgets(str,sizeof(str),stdin); printf("enter the inserting string: "); fgets(str1,sizeof(str1),stdin); printf("enter the position: "); scanf("%d",n); for(i=0,k=0;i<n;i++,k++) str2[k]=str[i]; for(j=0;str1[j]!='\0';j++,k++) str2[k]=str[j]; for(i=n;str[i]!='\0';i++,k++) str[k]=str[i]; printf("%s",str); } no errors for example output will be like this enter the string:rohinnj enter the inserting …

Member Avatar for deceptikon
0
208
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { char x[10],y[10]; int i,j,k,flag=0; printf("enter the string: "); fgets(x,sizof(x),stdin); for(i=0;x[i]!='\0';i++) for(j=0,k=i;x[k]!='\0';j++,k--) { y[j]=x[k]; } if(x==y) { printf("the string is palindrome"); } else { printf("not palindrome"); } }

Member Avatar for rithish
-1
302
Member Avatar for anallan

my professor gave this machine problem as a part of our finals.can you help me out/ here are the instructions: 2 player tictactoe -program a 2player tictactoe game wherein two players alternately key-in the coordinates to which they want to place a 'o' or an 'x' -the game board is …

Member Avatar for saurai3h
0
1K
Member Avatar for mvmalderen

This is how mine [B]strcmp[/B] function would look like if I'd to implement it from scratch :)

Member Avatar for ibykow
0
666
Member Avatar for jigar23

I am trying to create a basic program with a user defined header file.I created the project in visual studio. #test1.cpp # #include <stdio.h> #include "multiply.h" int main() { int y; y=multiply(5,10); printf("%d\n",y); printf("%s","jigar"); getch(); return 0; } # multiply.h # int multiply(int a,int b); # multiply.c # #include "multiply.h" …

Member Avatar for jigar23
0
311
Member Avatar for techy23

Hi! i have to *create a game , purely in C Language*. How to start and how to end? what kind of game can i try to make? which IDE to use ? i cant run <graphics.> header file for graphics in any IDE. How to configure init() = (&gm, …

Member Avatar for WaltP
0
415
Member Avatar for soham.m17
Member Avatar for allomeen

Hi, I having this error and i don't know how to fix it, can anybody help please: "declaration of `c' as multidimensional array must have bounds for all dimensions except the first", i'm getting this error because of : [code]void lcs::LCS_Length(int X[], int Y[], [COLOR=Red]int c[][], char b[][], [/COLOR] int …

Member Avatar for deceptikon
1
833
Member Avatar for rithish

#include<stdio.h> #include<conio.h> #include<stdlib.h> void main() { char a[100],b[50],c[50]; int i,n,j,k,d; printf("enter the string: "); fgets(a,sizeof(a),stdin); printf("enter the string to be removed: "); fgets(b,sizeof(b),stdin); printf("enter the string to be searched: "); fgets(c,sizeof(c),stdin); for(i=0;a[i]!='\0';i++) { if(a[i]==b[0]) { k=i; printf(" \n the first character is at %d",k); printf("\n lets see whelther searchstring is …

Member Avatar for deceptikon
0
265
Member Avatar for Qonquest

My assignmnet is to read a csv into a structure. A few sample lines of the csv look like this: 21, John Henry Blue, 6598 Wish Street, Elves, CA, 54862 9, Chad Vile, 32 Bundle St. , Carver, IN, 28105 I can't use pointers, except to point to the file …

Member Avatar for WaltP
0
180
Member Avatar for vijayabhaskar.chowdary

1) Write a program to make commandline calculator ? Format like that : excutablefile firstoperand opertator secondoperand Ex : ./a.out 1 + 3 result : 5

Member Avatar for WaltP
-1
89
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> #include<string.h> void main() { char a[200],n,c,b; int i; printf("enter the new string: "); scanf("%20s",a); printf("enter the character to be replaced: "); scanf("%20s",b); printf("enter the new character: "); scanf("%20s",c); for(i=0;a[i]!='\0';i++) { if(b==a[i]) { a[i]=c; } } printf("%s",a); } i have 0 errors when compiler starts to work.it …

Member Avatar for deceptikon
0
175
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { char a[100]; int i,c=0; printf("enter the text: "); scanf("%20s",a); for(i=0;a[i]!='\0';i++) { if(a[i]==32) { c++; } } printf("number of spaces in text is %d",c); } ascii value of space is 32 but it shows o spaces in output

Member Avatar for rithish
0
115
Member Avatar for I_m_rude

hi... typdef char * hello; const hello ptr1,ptr2; So, in this snippet, my question is that what is constant ? is ptr1 constant or the value to which ptr1 will "point to" will be constant ? and will u please give reason also? my thinking: const hello means (const char …

Member Avatar for deceptikon
0
280
Member Avatar for I_m_rude

hi, #include<stdio.h> int main() { const int i=10; int *ptr= (int*)&i; printf("%d",*ptr); *ptr=11; printf("%d",*ptr); printf("%d",i); getch(); return 0; } in this, we trickly changed the value of a constant variable. how is it changing the value of i ? in the o/p it is giving o/p , value of i …

Member Avatar for I_m_rude
0
118
Member Avatar for I_m_rude

hi, int common(node *temp,int c,int d) { int a=0; if(temp==NULL) return 0; else if(temp->a==c || temp->a==d) return 1; a=common(temp->left,c,d)+common(temp->right,c,d); if(a==2) { printf("%d\n",temp->a); // break; return 0; } else return a; } this is my recusrion code. Actually, I want to end this recusrion process by adding some statement where i …

Member Avatar for I_m_rude
0
90
Member Avatar for I_m_rude

hi, int arr[2][2][2]={1,2,3,4,5,6,7,8}: int *p,*q; q=(int*)arr; printf("%d",*q); my question is that how is it giving output as "1"(ofcourse, without quotes). what will change if i don't typecast arr in 3rd line of code? will anyone please explain.Is it giving o/p "1" ,just because of that typecast ? my thinking: as …

Member Avatar for I_m_rude
0
254

The End.