19,876 Topics

Member Avatar for
Member Avatar for sonum04

hey sir, i need your help to solve a program? question is= write a program for assesment system of university. the basic idea is to calculate the GPA of each subject and then calculate the GPA of whole semester and the basic of that GPA calculate the grade and remarks? …

Member Avatar for np complete
0
102
Member Avatar for prathiyus

i need to copy the pixels from one image to another not all the pixels int copy(image2,i,j,image1 k,j) and return the image2 how to write the function completely

Member Avatar for Adak
0
113
Member Avatar for GenieZ

Hello, I'm new in C. I'm getting warning: warning: format '%s' expects type 'char \*', but argument 2 has type 'char (\*)[256]' Here is the code: typedef struct { char operation[256]; char value[256]; unsigned long long key; } Input; int main() { Input input; while (scanf("%s",&input.operation) !=EOF) { if (input.operation[0]=='+') …

Member Avatar for GenieZ
0
103
Member Avatar for xIXZeroIXx

hello everyone, im having a headache with this error im getting, im trying to read a number from a file but inside a Switch(case) statement but im getting alot of erros only inside the case and i cant figure out why if my open file code is correct (as far …

Member Avatar for xIXZeroIXx
0
289
Member Avatar for prathiyus

just writing and testing the code using arrays, int main() { int i,n; int arr[14]; printf("\nEnter the array ",n); scanf("%d",&n); int lastindex = n-1; int *l; l = &lastindex; for(i = 0;i<n;i++) { scanf("%d",&arr[i]); } for(i = 0;i<n;i++) printf("\n%d\n",arr[i]); printf("%d",*l); //arr[i] = lastindex + 2; //printf("\n%d",arr[i]); if(arr[lastindex[arr]] < lastindex) { …

Member Avatar for Ancient Dragon
0
230
Member Avatar for katsmiley

In this program i have put numeric value in char variable. Trying to observe what happens when using %d and %c specifier. void main() { char ch=23; printf("value:%c",ch); getch(); } here when i use %d i get value:23 when i use %c i get some odd char. why the result …

Member Avatar for Tumlee
0
323
Member Avatar for maraghuram

I am trying to delete the leaf nodes in a bst which i have created non-recursively. The problem is when i am trying to delete the leaf node i hit a segmentation fault and i have no clue as to why its happening. I believe the code which i have …

Member Avatar for Gonbe
0
789
Member Avatar for jeeter19

Hi, I am trying to copy all contents from one directory over to another directory. This is the code I have so far: [CODE] #include <dirent.h> #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #define MAXNAME 80 #define R_FLAGS O_RDONLY #define W_FLAGS (O_WRONLY | …

Member Avatar for fkjhadslf
0
2K
Member Avatar for Icekilla

Hey guys, I'm building a program in C that can get powers of 2. The user inputs the value of n, and the program calculates 2^n. Here's the code #include <stdio.h> double power(int n) { int q; double c=2; for (q=n; q>1; q--) {c=2*c;} return c; } int main() { …

Member Avatar for Adak
0
176
Member Avatar for prathiyus

hetThe code is the executing fine,but i need to keep a pointer variable to return the last index of the array //for eg if i enter n as 20,my lastindex is 19,the pointer will return the lastindex... void sort(int a[],int *,int); void swap(int a[],int *,int,int); int main(void) { int i,n,a[100],b[100]; …

Member Avatar for prathiyus
0
136
Member Avatar for kidpro

## im begginer of c language n working on turbo now days,please tell me how can i repeat a program after run one time. i use while but on press any key this program run every time no exit.please correct it ## main() { char again='y'; while(again=='y'||again=='Y') { int a,b; …

Member Avatar for Adak
0
130
Member Avatar for php111

Hey everyone, I never programmed before in no languages, but I would like to learn C, and I'm undecided on what book to read to learn from. I have no possible experience at all. May someone tell me as a beginner should I read either C Primer Plus by Prata? …

Member Avatar for php111
0
762
Member Avatar for IAMADOG

I was looking at some sample code [here](http://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html) and it had this for error handling: #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) If I remember correctly do {} while (0) would execute only once, so what is the point of this?

Member Avatar for deceptikon
0
128
Member Avatar for prathiyus

I need to write equivalent 'c' code for vb code......... ImageScreen.Graphics.Pixel(i,j) = cmy(0,0,0) how to write a function for cmy in c language

Member Avatar for Adak
0
79
Member Avatar for joao.jose.520

Hellou. Can anyone tell me how can i save a string to a file? I have this function: void PrintGameBoard(jogo_4line*jg) { int i,n; system("clear"); printf("===============Jogo do 4 em linha===============\n\n\n"); printf(" +--+--+--+--+--+--+--+\n"); for(i=1; i<=6; i++) { printf("%d |%c |%c |%c |%c |%c |%c |%c |\n",7-i,jg->T[i][1],jg->T[i][2],jg->T[i][3],jg->T[i][4],jg->T[i][5],jg->T[i][6],jg->T[i][7]); if (i!=0) printf(" +--+--+--+--+--+--+--+\n"); } printf(" …

Member Avatar for Adak
0
233
Member Avatar for code_r

Hi, I'm working on some questions for homework and I have a small idea what the answers may be. Can anyone look my answers over and help me out maybe explaining why they may be wrong or right? Question 1: answer "b" Here is a diagram of memory: Which declaration …

Member Avatar for Gonbe
0
168
Member Avatar for amrita111
Member Avatar for amrita111
0
155
Member Avatar for tahity1

I am still new with c programming, I need to create queue with first in first out but it is going last in first out. Can someone give me advice in how to make it work. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LENGTH 30 #define NUMOFEMPLOYEE 15 typedef struct …

Member Avatar for VernonDozier
0
125
Member Avatar for cacadi

So i am doing a program that opens a file that contains grades and shows the average, total, etc.. But at the end I am supposed to make a histogram that would look something like this A= * * B= * * * C= * * * * * * …

Member Avatar for rstralberg
0
466
Member Avatar for amishosh

Hi, I looked all over and since I'm probably not using the right termonlogy I couldn't find anything in Google. Here's what I'm trying to do (in ANSI C). I have a text that represents a series of bytes that looks like this: "08 FF AB 0B 12 76 CD" …

Member Avatar for deceptikon
0
195
Member Avatar for sunygirl92

I need to create a sorting program with C from a txt file. I need to use bubble sorting and insertion sorting. All I have right now is what the professor gave us to start. I don't know where to go from here! Please help! Program so far: #include <stdio.h> …

Member Avatar for Adak
0
155
Member Avatar for bikash barad

void main() { unsigned int x=500; int y=-5; if(x>y) printf("hello"); else printf("hi"); getch(); }

Member Avatar for amrita111
0
98
Member Avatar for leesin

Hi everyone, i got a question about the fscanf. I input a file and scan the data in the file. It works good that if there are integers in line1,2,3,4 in the file. However, it does not work good with empty file or the file only has dat in line …

Member Avatar for leesin
0
98
Member Avatar for chandnigandhi

please suggest me turbo c version for windows 7,32 bit which supports full screen mode and also supports graphics functionality....as soon as possible....

Member Avatar for Ancient Dragon
0
101
Member Avatar for ja3n

Hi, I am trying to solve a maze using queues(no recursion) What I've done so far is that I can figure out whether or not the maze can be solved. What my next step should be is to list out STEP BY STEP how the maze will be solved. For …

Member Avatar for ja3n
0
3K
Member Avatar for katsmiley

suppose i have defined constant using #define MAX 5 and i am using it in function called find() as shown below: find() { if (MAX==5) { //do this; } else { //do this; } } ** If i am calling this function 100 of times** then which way is better …

Member Avatar for deceptikon
0
165
Member Avatar for gwolf1

Hi Everyone, I was wondering how I can implement a hashmap function in C. I have to define a struct: struct hashmap; typedef struct hashmap hashmap; This has to be a multimap so that a key can point to different values. If also need to initialise this hashmap like so: …

Member Avatar for deceptikon
0
575
Member Avatar for sachi059

Hello i found that only register storage class is allowed in function.But it gives error when i mae it extern auto,extern static... Hello i found that only register storage class is allowed in function.But it gives error when i mae it extern auto,extern static... #include<stdio.h> int sum( int ,int,int ); …

Member Avatar for deceptikon
0
877
Member Avatar for prakhs
Member Avatar for nitin1

Can you please give me hints or can you teach me how can i convert my simple client server program(in which only client can send any number of messages it want to server) to chat server client program ? I am doing this by trivial way, but still only server …

Member Avatar for nitin1
0
2K
Member Avatar for prathiyus

**i'm trying to sort the number in the ascending order,i have a problem in doing that....im quite new to c ** *my input is a={40,50,20,30};,b={20,30,40,50};my output will be a=20 30 40 50 ,b=40 50 20 30 * sorting all the columns of a data by one of its column int …

Member Avatar for prathiyus
0
338
Member Avatar for vipulasri.2007

Write a program that reads a file, breaks each line into words, strips whitespace and punctuation from the words, and converts them to lowercase please help me out . thanks in advance

Member Avatar for vipulasri.2007
0
682
Member Avatar for jcmoney1010

Alright i'm trying to write a program that checks a list of names entered by the user to see if the new name entered is part of the list. If it's not part of the list it should return -1 to the main, and print no names found, if it …

Member Avatar for dmanw100
0
113
Member Avatar for dancks

I don't know jack about Visual Studio, and I'd like to keep it that way because I like doing stuff on the command line, I have my preferences. But my teacher uses it to compile and I'm curious what I did wrong because gcc didn't throw anything. So, code (Without …

Member Avatar for dancks
0
202
Member Avatar for MARKONINI

Hello, I'm now year 12 in a programming oriented high school and I have some 3-4 months to complete a programming based project. I know SQL (completed "Introduction to Computer Science" course), PL/SQL (New to PL/SQL but I'm learning fast), C# (learned it 3 years and had good grades) and …

Member Avatar for Momerath
0
336
Member Avatar for djbsabkcb

Below is my code for Fibonacci sequence, however when I use a large number such as 100 or more it takes forever to produce output. Why? any help would be appreciated. :( [code]#include <iostream> using namespace std; long fib_num ( long ); int main() { long num = 0; long …

Member Avatar for josh2k12
0
2K
Member Avatar for RadhikaR
Member Avatar for Ancient Dragon
0
45
Member Avatar for AnnA.B

Could you please help me how to create a four in a row game in C? Thanks!

Member Avatar for joao.jose.520
1
1K
Member Avatar for samii1017

So I'm new to C and I'm having a problem with arrays. In my program, I let the user enter up to 5000 numerical values. I have the program set up in a menu system, so each time, the user can chose to enter a new number, or view what …

Member Avatar for Ancient Dragon
0
227
Member Avatar for aman55

:#include<stdio.h> #include<conio.h> void main() { int i; float x[10],value,total; clrscr(); printf("enter ten real numbers"); for(i=0;i<10;i++) { scanf("%f",value); x[i]=value; } total=0.0; for(i=0;i<10;i++) total=total+x[i]*x[i];//eliminate total from here printf("/n") for(i=0;i<10;i++) printf("[%2d]=%5.2f/n",i+1,x[i]; printf("total=%2f/n",total); } if i write total=x[i]*x[i] =102 an another answer why?? nd if wrie=total=total+x[i]*x[i] =446.86 10 real number 1.1, 2.2 ,3.3 ,4.4 …

Member Avatar for alaa sam
0
176
Member Avatar for leesin

I want the program can do that for me. When I enter the name of file in the same folder of .exe, the program will scan the file data and print it out the data in order. However, i do not know how to scan the data in the file …

Member Avatar for Ancient Dragon
0
152
Member Avatar for prakhs

#include <stdio.h> #define MAXSIZE 100 int memo[MAXSIZE][MAXSIZE]; int aukermann(int m, int n) { if (memo[m][n] != -1) return memo[m][n]; if (m == 0) return (memo[m][n] = n + 1); else if (n == 0) return (memo[m][n] = aukermann(m - 1, 1)); else { memo[m][n-1] = aukermann(m, n-1); return (memo[m][n] = …

Member Avatar for dooma
0
176
Member Avatar for katsmiley

I have written one small program to check whether particular bit is set or not. But not getting proper value when i check for upper nibble. #define check(var,pos) ((var)&(1<<pos)) void main() { int var=30;// in binary 0011 0000 that is its 4th and 5th bits are set; int bit; printf("enter …

Member Avatar for katsmiley
0
643
Member Avatar for Enders_Game

Pretty self explanatory code. Why doesn't it work! #include <stdio.h> int main() { __asm__("number dw 0"); // declare number? printf("%d",number); __asm__("mov %eax,number" "inc %eax" "mov number,%eax"); printf("%d",number); return 0; } cc ex1.c -o ex1 ex1.c: In function ‘main’: ex1.c:22:17: error: ‘number’ undeclared (first use in this function) ex1.c:22:17: note: each …

Member Avatar for Enders_Game
0
290
Member Avatar for Ismail Issa

Hey guys. i am new to c# and i was wondering if you could give me a hand. it is about sets.So far i have 3 textboxes,one for set a one for b and another for result.i also have 3 buttons one for union one for difference,element found in a …

Member Avatar for ddanbe
0
116
Member Avatar for ntggl19

hello everyone i'm new ic and i have a problem on structs, on the very simple i want to create a struct with one int and a char table 3 potisions,this is my code #include <stdio.h> #include <string.h> #include <conio.h> struct domi { int code; char name[3]; }; main() { …

Member Avatar for ntggl19
0
203
Member Avatar for nitin1

hello, Can anyone please tell me the most efficient know till date so as to find the prime numbers up to 10^8 or higher. I am using sieve and using odd number optimization with it also. but it is not too much effiecent which i want. Can you please any …

Member Avatar for Adak
0
112
Member Avatar for pooja.singh.3950

can any1 give me flowchart and algorithm for 1) counting positive numbers from a given set 2) gcd and lcm of two numbers 3) smallest positive divisor of an integer other than 1 so from above i would be able to make program on my own

Member Avatar for Adak
0
114
Member Avatar for Twilitbeing

(I'm a Computer Science 101 student writing programs in C on a virtual Linux machine.) Suppose I wanted to apply a single (arbitrary) function to every element of an array, one at a time. Doing this once is easy enough, but I'd like to find a method that could accomplish …

Member Avatar for dmanw100
0
270
Member Avatar for ThomsonGB

I have been using the Jove editor by Jonathan Payne for many years. If You are not familiar with Jove - Jove stands for Jonathans own version of EMACS. I love using it. In the 80s I had my own version of jove with a lot of my own personal …

Member Avatar for ThomsonGB
0
345

The End.