15,552 Topics

Member Avatar for
Member Avatar for f1r0z3

Hello... I'm trying to write a program in C (using POSIX library) where the parent process should fork up to M processes and play "connect four" or "four-in-a-row" with each-other until one of them wins, and when that happens, the process should terminate. This can be done either via pipes …

Member Avatar for Adak
0
225
Member Avatar for Truesteel

I am working on writing a program for my C programming class in which we have to make a basic program that can balance a checkbook. It prompts the user for a starting balance, can add and subtract amounts, and should deduct a $10 fee if the user overdrafts. The …

Member Avatar for jonsca
0
616
Member Avatar for GmatCat

Hey I got this assignment and got an error halfway through but don't know what is it it said: Error Declaration syntax error in function main() btw this is a really basic code so here's the code. #include <stdio.h> #include <conio.h> float circumference(int); int area_tri(int,int); int area_rec(int,int); float area_sqr(int); int …

Member Avatar for gerard4143
0
73
Member Avatar for jimu

i am a beginner .can anyone just give me a code to make a txt file using c code,that will create txt file with name same as the value of int variable.. consider like if int x=10,then file name created will be 10.text if x is assigned 45 then it …

Member Avatar for jimu
0
202
Member Avatar for jephthah

i dont normally work in the console/terminal window in my day job. so, i keep rewriting this every time i respond to someone needing help related to getting user input. im putting it here partly so i dont have to keep rewriting it. this function will get a string input …

Member Avatar for BNF
1
1K
Member Avatar for mikecolistro

Hi there, I'm writing a function that fills the array with numbers from 1 - 52 with no repetitions basically my main problem is the second set of loops or the nested loops are, check to see if it is repeated and if it is it puts a new number, …

Member Avatar for mikecolistro
0
151
Member Avatar for erictham83

how to write a program for raising a number to a power(integer only) (e.g 2^2=4 ; 3^3=27 etc) [COLOR=Blue][B]without [/B] [/COLOR] using a precompiled C function(ie pow()). [COLOR=Blue][B]but [/B] [/COLOR] only used addition, substraction, while loops,if statement and/or for loop.

Member Avatar for shiva_202
0
405
Member Avatar for sketchiii

The code I wrote for a digital clock always falls behind the clock in my windows 7 taskbar after being run for like 2-3 mins. Why? Here's the code: [CODE]#include <stdio.h> #include <time.h> #include <windows.h> int main() { int h,m,s; time_t epoch_time; struct tm *tm_p; epoch_time = time( NULL ); …

Member Avatar for Adak
0
222
Member Avatar for sketchiii

I figured out how to use time in C since the last time I asked a question here. :cool: My new dilemma is that I was wondering if its possible to save user input in a C program so that when the program is closed and executed again it will …

Member Avatar for sketchiii
0
188
Member Avatar for ram619

ITS NOT MY HOME WORK I m Just Keen to do it. I don't want you to give me the code. I just want you to tell me how to access VDU and directly change character on same screen. The screen is divided into 25 rows and 80 columns. The …

Member Avatar for Adak
0
598
Member Avatar for jsfrocha

Hi, I just installed Dev-Cpp for a IT class and started up with a basic program to see if all was alright: [CODE]#include <stdio.h> int main() { printf("Ola Mundo"); system("PAUSE"); }[/CODE] Still, when i tried F9 (Compile & Run), appear this errors: [Linker error] undefined reference to `__dyn_tls_init_callback' [Linker error] …

Member Avatar for jsfrocha
0
352
Member Avatar for chess2009

Could you please help why my program goes through do while loop just once, although the condition is true. //Program is getting numbers from user and realize whether they are correct numbers for triangle side or not and if tey find out the area// [CODE] #include<stdio.h> #include<math.h> double TraingleArea(); int …

Member Avatar for Adak
0
130
Member Avatar for fg_aa_c

Hi I have written the following code but when I run it, it fails to bind every time, any ideas why? [CODE]int main(int argc, char *argv[]) { int port = 1080; int lsd, sd; struct sockaddr_in serv_addr, remote_addr; socklen_t remote_len; if(argc < 2 || argc > 2) { printf("Syntax is: …

Member Avatar for fg_aa_c
0
1K
Member Avatar for toolbox03

#include <string.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> void error(char *msg) { perror(msg); exit(0); } int main(int argc, char *argv[]) { int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[256]; if (argc < 3) { fprintf(stderr,"usage %s hostname port\n", argv[0]); exit(0); …

Member Avatar for gerard4143
-1
133
Member Avatar for Xytheron

Hey all! So my buddies and I have been in the OS programming class and we've gotten ourselves an idea. We get free range to the Unix server for academic purposes and we thought it might be fun to try and write a PTC server so we can chat across …

Member Avatar for Xytheron
0
88
Member Avatar for ram619

could you please tell me whats happening at line number 8 because, the output is 3,2,30. How can the value be incremented twice with just one increment. Thanks ! [code=c]#include<stdio.h> #include<conio.h> int main() { int b[5]={10,1,30,40,50}; int j,i,k=1,m; i=++b[1]; j=b[1]++; m=b[i++]; printf("%d %d %d",i,j,m); getch(); } [/code]

Member Avatar for ram619
0
84
Member Avatar for ram619

I m trying to print the prime numbers using Sieve of Eratosthenes But, my output is 0 for all. please tell me where i m wrong. Thanks for help [code=c]#include<stdio.h> #include<conio.h> int main() { int arr[100],i,j=1,val=0,mod,num=0,k,l; for(i=0;i<100;i++) { arr[i]=j; j++; // printf("\n %d",arr[i]); } for(k=1;k<100;k++) // checking number and replacing …

Member Avatar for ram619
0
123
Member Avatar for westony

[CODE]#include <stdio.h> #include <string.h> void proba(char *test) { int i; char det = *test; printf("%s", det); } int main(void) { char datar[] = "asds"; printf("%d \n", datar); proba(datar); return 0; }[/CODE] printf("%s", det); is the problem. When its turn to execute its trowing me out from the app. With "wrong …

Member Avatar for westony
0
107
Member Avatar for elsiekins

Hi - i have been trying to create a linked list in C using structs and there are a couple of things i am stuck with how to declare the node front and back and do i keep repeating myself? Also in the function push back how can i use …

Member Avatar for elsiekins
0
286
Member Avatar for Luckychap
Member Avatar for Adak
0
2K
Member Avatar for Dawn76

I'm new to computer programming, and I need help. I have researched, and read my book; however, I just can't seem to grasp pseudocode. i have to write a program that accepts data for an order number, customer name, length and width of desk ordered, type of wood, and number …

Member Avatar for Adak
0
113
Member Avatar for tom1252

Hi, I have created a bubble sort as a function in C. It sorts an array of numbers. I am not sure how to print them out though(SORTED). Thanks

Member Avatar for Adak
0
95
Member Avatar for jacob21

Hello friends, Please tell me how to reverse string in c like taht. My name is jacob jacob is name my

Member Avatar for gerard4143
0
111
Member Avatar for rjbrjb777

i have a program in c language that reads csv file.. now i want to read data column wise.. i want the whole program..which will take file name as command line argument and will fetch second column from the file.. lets assume file is like below.. aggromat,"1","abc","8903" aggromat,"2","abc","ddds" reply as …

Member Avatar for rjbrjb777
0
2K
Member Avatar for ram619

I have written this code for insertion sort but, its not generating any output. could you please tell me whats wrong in this code Thanks!! [code=c]#include<stdio.h> #include<conio.h> int main() { int arr[25]={1,2,3,4,5,6,7,8,9,21,15,16,18,22,24,72,77,79,91,62,27,35,11,90,110},i,temp=0,j,a; int *p; for(i=0;i<25;i++) { if (arr[i]>arr[i+1]) { temp=arr[i]; arr[i]=arr[i+1]; arr[i+1]=temp; p=&arr[i]; while(i!=0) { if(*p<arr[i-1]) { temp=*p; *p=arr[i-1]; arr[i-1]=temp; …

Member Avatar for Adak
0
184
Member Avatar for iammirko

I am a newbie to network programming. I been trying my luck with winsock and am stuck with no idea what to do. Here is a snippet of my code: [CODE]//Bind it to a TCP/IP port SOCKADDR_IN SockAddr; SockAddr.sin_port=24; /*Port to be used*/ SockAddr.sin_family=AF_INET; /*Connection Type: TCP/IP*/ /*Listen on IP …

Member Avatar for iammirko
0
239
Member Avatar for kayhantolga

I need ascii number for forward keys. i found it but it has two number examble first -32 and second 80?? please help

Member Avatar for kayhantolga
0
86
Member Avatar for peck3277

Hi guys, if anyone can help here it would be great. I'm running Windows XP SP3. I have at the moment a micro-controller connected to my serial port. Using the micro-controller I can get temperature data and send display it in a terminal. I can program the micro-controller in C. …

Member Avatar for Ancient Dragon
0
102
Member Avatar for keicola

hi. i made a function which is supposed to create a binary tree from preorder and inorder traversals using recursion. i did this by making arrays for the left subtree and the right subtree in preorder and in inorder at each call of the function. makeNode() puts the data into …

Member Avatar for keicola
0
199
Member Avatar for hariharan89

int main(int argc, char **argv) { char **myargv = argv + 1; while (myargv[0] && myargv[0][0] == '-') { if (strcmp(myargv[0], "-d") == 0) { myargv++; continue; } exit(1); } argc -= (myargv - argv); argv = myargv; Hi , I am new to C programming . I understood the …

Member Avatar for gerard4143
0
135

The End.