15,539 Topics

Member Avatar for
Member Avatar for popcorn99

I wrote a simple echo program, which reads standard input character-by-character and then prints it to standard output character-by-character. [code] #include <stdio.h> int main() { int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } [/code] I was expecting it to break out of the while …

Member Avatar for jephthah
0
138
Member Avatar for tedsu

I am trying to print out the number of occurences for each alphabetic chracter in a file that our instructor provided us with. The values range from 1 to 999. I'm trying to print out "count[...] : " followed by the character. So far my counts are correct. However, at …

Member Avatar for Banfa
0
187
Member Avatar for Griff0527

I just started this program a few hours ago, and I am running into an error that I do not understand. I tried finding an answer on Google as well. First off, this is the bare bones of a code right now. I have not started any of the sub-functions …

Member Avatar for Griff0527
0
136
Member Avatar for R3Slick

does someone know a code in c that will send a complete ASCII file in 128 byte packets to another file? So The sender takes the ASCII file as input and sends a 128 byte packet on the data queue

Member Avatar for R3Slick
0
191
Member Avatar for thomasekugm

I am writing a small algebra io program for an intro to c class and i am stuck. The idea is to get the user to input (a * b) + (c / d) + (e % f), in exactly the same format as you see it with the exception …

Member Avatar for jephthah
0
225
Member Avatar for Griff0527

Ok, I have read several other questions basically asking the same thing, but I know this code can work instead of using other peoples work. Yes, i'm stubborn. I have written a function to be called from my main program and i keep getting an error that I cannot figure …

Member Avatar for jephthah
0
745
Member Avatar for msaqib

This is an automated system for Bank Management. It uses files to handle the daily transactions, account management and user management. Nice graphical layout and mouse functionality. Manager can add, edit and delete the users and manage the user accounts. Code From: <URL SNIPPED>

Member Avatar for jephthah
-2
312
Member Avatar for nunos

I need help with debugging this piece of code. I know the problem is in malloc and free but can't find exactly where, why and how to fix it. Thanks. [CODE] #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> #include <string.h> #include <sys/wait.h> #include <sys/types.h> #define MAX_COMMAND_LENGTH 256 #define MAX_ARGS_NUMBER …

Member Avatar for nunos
0
173
Member Avatar for yasy

Write a function called nRandomNumbers( ) to performing the following: • Generates N random integers between -250 and 250 (inclusive) and save them in a file called number.txt, (Use the function srand()). • Prints all the generated integers. • Finds the average of all the negative integers, and the maximum …

Member Avatar for Adak
0
106
Member Avatar for Idontknowc

I'm currently trying to create a code in Cygwin using pure C to display ASCII control characters that may be present in the text file in a ASCII control characters non-printable form. I can call to a text file to display its contents but in normal ASCII characters but I …

Member Avatar for Ancient Dragon
0
321
Member Avatar for oggiemc

Hi everyone, Ive been asked to do an assignment to test the randomness of a linear congruential generator..We've been given the code implemented in c..the problem is i dont really see how this code relates to the theoretical LCG equation i.e X[n+1] = (aX[n] + c) mod m..So i would …

Member Avatar for invisal
2
1K
Member Avatar for Ammar1990

Hi All, I am new to C language and am suppose to write a program that gives me an even integer with cube greater than 40000 and also is divisible by 7. This is what i have... [CODE]#include <stdio.h> #include <stdlib.h> #include <math.h> int main(){ float a,b,c,d,e; a=pow(40000,1/3); while(pow(40000,1/3)<=a){ a=b; …

Member Avatar for Adak
0
113
Member Avatar for vladdy19

I'm having trouble running C in eclipse. It first gives me weird syntax errors or tells me that # include <stdio.h> is an "Unresolved inclusion" It also will not let me build, saying "(Cannot run program "make": Launching failed)" Am I missing something? please help. Thanks

Member Avatar for lmpmbernardo
-1
790
Member Avatar for hosam2k

hi all do anyone understand hash function? how to use it in order i can count a digit number of size 10? then i separated it half half (into 5 digits each) :)

Member Avatar for hosam2k
0
145
Member Avatar for manjotpahwa

//*************************SERIOUS PROBLEM, NOT WORKING****************** [CODE]//DOUBLY LINKED LIST #include<stdio.h> #include<stdlib.h> struct dll { int info; struct dll *next; struct dll *prev; }; struct dll *head = NULL, *tail = NULL, *temp; void append(); void insafter(); void delete(); void display(); void main() { int choice; do { printf("Enter your choice:\n"); printf("1.Append Node\n2.Insert …

Member Avatar for jephthah
0
155
Member Avatar for Muhammadlodhi

[CODE]int main(){ char i,input[30],close,open; for(i=0;i<='.';i++){ printf("enter equation"); scanf("%c",input[i]); if(input[i]=='(') input++; input[i]=open; else if(input[i]==')') input[i]--; input[i]=close; else if(open[i]==close[i]) { printf("paranthesis are balance"); } else printf("paranthesis are not balance"); } getch(); return 0; }[/CODE]

Member Avatar for jephthah
-2
111
Member Avatar for jeffhorton1965

Help please.. I need some help in C to open a file and search for a string. If the string is found then move one space and copy the next string to end-of-line back to buffer. I am creating a program using pthreads and need to search this file in …

Member Avatar for jeffhorton1965
0
135
Member Avatar for Muhammadlodhi

i want to write this program without lib and string files make changes in it and tell me the program thanks code is below[CODE]#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct Node; typedef struct Node * PtrToNode; struct Node { char element; PtrToNode Next; }; PtrToNode MakeEmpty(PtrToNode L) { L= new(Node); L->Next=NULL; return …

Member Avatar for Muhammadlodhi
0
110
Member Avatar for adrawat

Hi, I have a file in C which has many lines. I want to store each line separately so that i can reference it later with a char *host. How can i do that? Thanks.

Member Avatar for WaltP
0
276
Member Avatar for Voltron160

Hello guys, I started this project but cant seem to finish it. You guys are my last hope, any help would be GREATLY APPRECIATED.These are the requirements, it seems I am mixed up. The owners of Body Language Fitness Centre require an information system that can manage and maintain their …

Member Avatar for jephthah
0
126
Member Avatar for Muhammadlodhi

This is begining. BALANCE PARANTHESIS and show the result of ((9-4)/(44*34)) etc ??? what to do? int main() { char arr[30]; for(int i=0;i<30;i++){ if(c=='(') c++; else if(d==')') d++;} if(c==d) printf("parenthesis are balance"); else printf("are not balance"); } further cant understand.

Member Avatar for Adak
0
147
Member Avatar for Gonbe

Hello Daniweb. [B]Scenario[/B] For a project we have to write a irc server. For this, we first wanted to investigate what kind of server architecture we should apply. (e.g. multithreading, multiplexing, multiprocessing etc.) We've written simple servers which implement different architectures. The servers basicially receive a message, and then send …

Member Avatar for nezachem
0
134
Member Avatar for DCvonB

Hello, I am trying to get the following code to print out the number of days in each month using pointers. This what the program currently prints: Enter a year (ex. 1997): 2001 Year entered: 2001 --Not a Leap Year!-- Number of days in each month: January: 0 February: 0 …

Member Avatar for Aia
0
145
Member Avatar for Xufyan

how can i add the last value to the current value using loop..? i tried so much but didn't find the answer :( [CODE]void main(void) { int numbers,add,sec; clrscr (); for (numbers=1;numbers<=49;numbers++) { for (sec=numbers;sec<=numbers;sec=numbers+sec) printf ("%d ",sec); } getch(); }[/CODE] here the loop is from 1 to 50, i …

Member Avatar for Xufyan
0
100
Member Avatar for Cheran

hi everyone... i"ve to pass a string as a returning value.but wat is the problem is there is an integer in the middle of it.the problem arise here.. [code]char* my_string( char* dest,char *c) { char str1[25] = "C:\\windows\\"; char str2[25]; char str3[25] = ".jpg "; strcat(dest,str1); //append str2 to str …

Member Avatar for Aia
0
139
Member Avatar for pramoda.ma

Hi All, How to copy one 2D-array to another without using loops and library function of C. Not pointers. Regards, Pramod

Member Avatar for Ancient Dragon
0
5K
Member Avatar for mariosbikos

hi guys i have an urgent problem....we have been asked to make a battleship game in C which will have the formation of ships taken by a file txt.....for example 00000000 ppp00000 0000nnnn 00000000 etc...i want to open the file txt and then put every single character 0,p,n etc to …

Member Avatar for mariosbikos
0
283
Member Avatar for deeep

Hello Guys, I have implemented a linked list. And my output looks something like dis: ************************************************* The elements in the list : address is = 163196952 ADOC1100250100000119666 address is = 163196968 ADOC1100250100000119666 address is = 163196984 ADOC1100250100000119666 address is = 0 ADOC1100250100000119666 TOTAL NO OF ELEMENTS IN THE LIST ARE …

Member Avatar for jephthah
0
161
Member Avatar for shahab.burki

Hi, I am stuck in file reading problem. I have tried various solutions but nothing worked. Actually I can't develop a logic to do so. I want to read some lines from file and pass them to structure. When reading a file you must use WHILE loop. I am posting …

Member Avatar for jephthah
0
90
Member Avatar for buckkitty

Does anyone understand why Data2 would not equal Data? I print, and can see, that they LOOK the same, i.e. have the same number of rows and columns with the same values in each element. But when I pass the matrices to a calc function, they give different results. I …

Member Avatar for buckkitty
0
85

The End.