15,552 Topics

Member Avatar for
Member Avatar for hantuapi

[CODE]#include<stdio.h> #include<string.h> #include<conio.h> struct menuItemType { char menuItem[15]; double menuPrice; } menuList[]= {"Plain Egg",2.50, "Bacon and Egg",3.45, "Muffin",2.20, "French Toast",2.95, "Fruit Basket",3.45, "Cereal",0.70, "Coffee",1.50, "Tea",1.80 },order[10]; void getData(struct menuItemType[],struct menuItemType[],int*); void showMenu(struct menuItemType[],int); void printCheck(struct menuItemType[],int ); int main() { int items = 0; printf("Welcome to HiFi's Restaurant\n"); printf("\n"); printf("******* …

Member Avatar for chrjs
0
123
Member Avatar for shantanusinghal

[CODE=c] int main(int argc, char *argv[]) { ifstream inHandle; Assembler obj; if(argc!=2) { cout<<"InvalidInput ERROR"; } else { inHandle.open("test.asm"); if(inHandle==0) cout<<"FileNotFound ERROR"; else obj.pass1(inHandle); } inHandle.close(); return 0; } [/CODE] this is my code for the main() function, i have tried entering the filename in every possible format but the …

Member Avatar for Narue
0
636
Member Avatar for Ajinkyanaik
Member Avatar for James singizi

How can one write a c password program that accepts only 3 attempts of password input

Member Avatar for navedalam
-1
100
Member Avatar for rockerjhr

ok here are the files [B]globals.h[/B] [CODE] #ifndef _globals #define _globals #define DATA( L ) ( ( L ) -> datapointer ) #define NEXT( L ) ( ( L ) -> next ) typedef enum { OK, ERROR } status ; typedef enum { FALSE = 0 , TRUE=1 } …

Member Avatar for Adak
0
283
Member Avatar for f.damati

Hello everyone, I wrote a c program in order to write 5 students records (name, ID and average) to a file. Now the difficult step is to firstly to find the highest average among students. Have anyone any clue how I can do this? Thank you

Member Avatar for WaltP
0
93
Member Avatar for VP2

Memory allocation. Pretty simple, but I guess there might be some people here who do not know what it is... [CODE]#include<stdio.h> #include<iostream.h> int main() { int *n = new int; *n=12; printf("n's value is %d\n",*n); *n=25; printf("n's value is %d\n",*n); delete n; printf("n was deleted\n"); system("PAUSE"); return 0; } [/CODE]

Member Avatar for WaltP
0
429
Member Avatar for efronefron

The problem is I use malloc in the last function(toString()). I just wanna know if there is anyway to free it? or that I dont have to? Thanks [CODE] #include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> /* Function prototypes */ void process(char input); void update(char words[][51], int position); char * toString(char character); /* …

Member Avatar for WaltP
0
210
Member Avatar for anirudhruia

for(j=0;j<3;j++) { repeat:if((int*)ch[j][l]>(int*)ch[j+1][l]) { strcpy(tmp,ch[j]); strcpy(ch[j],ch[j+1]); strcpy(ch[j+1],tmp); } else if((int*)ch[j][l]==(int*)ch[j+1][l]) { l++; } goto repeat; } for(i=0;i<3;i++) { printf("%s",ch[i]); } return 0; NOt gettin any output

Member Avatar for navedalam
0
121
Member Avatar for lochnessmonster

How do i prevent a C string input from the user from exceeding the capacity of the array? is this not possible? [code]int main() { char buffer[8]; printf("enter a string"); scanf(%s,&buffer); return 0; }[/code]

Member Avatar for navedalam
0
73
Member Avatar for ticktoc09

Im a noob in C and I got this simple code working.. [CODE]#include <stdio.h> #include <conio.h> #include <string.h> int main () { char str1[20]="burke",str2[20]; printf("Dog's name?:"); scanf("%s",str2); if (strcasecmp(str1, str2)==0){ printf("Gratz you got it",str2); } else{ printf("Wrong Answer!!!"); } getch(); } [/CODE] My problem is what if instead of "burke" …

Member Avatar for navedalam
0
115
Member Avatar for b56r1

Hi, can anybody help me with this program output. Program is based on GCC compiler standards [CODE=c]#include<stdio.h> main() { int *ptr=10,j; j=ptr+19; printf("ptr=%d\n",ptr); printf("j=%d\n",j); } [/CODE] [CODE=text]output: ptr=10 j=86[/CODE] when ptr value is 10 in statement "j=ptr+19", why the j value is 86??

Member Avatar for gerard4143
0
118
Member Avatar for kayhantolga

I was coding snake game. The game is working normally but I have a little problem.I can't set again commands block.For example The commands are accumulating when I have pressed the buttons,frequency. And note:My language is Turkish. If you want understand variable mean, may be want use googletranslate or boubletranslate.. …

Member Avatar for pseudorandom21
0
164
Member Avatar for negneg

Hi, I have wrote a program to do multiple linear regression (form the matrix ) and solve the relevant matrix using Gaussian Elimination,Unfortunately it is not running and once I get it to run it is gives me the error stating det=0. Please have a look and let me know …

Member Avatar for jonsca
0
199
Member Avatar for Josue198s

hi guys please help writing this shell script in C..please count2:[code] #! /bin/sh # count2 also increments and appends a value to the numbers file # but only when it can successfully create a new hard link to the numbers file count=0 while [ $count -lt 200 ] # still …

Member Avatar for griswolf
-1
222
Member Avatar for VP2

Hello! I've got a little problem... I want to make a program which puts 10 random character, but the characters should NOT be digits. [CODE]#include <ctime> #include <stdio> #include <iostream> using namespace std; int main() { time_t t; time(&t); srand(t); int i,c; char ch; printf("Generating 10 random characters...\n"); for(i=1;i<=10;i++) { …

Member Avatar for WaltP
0
151
Member Avatar for zangetsuu

when i run the program it skips the Int Tax(); function an i tried changing it to void an taking out return 0; but its still not working [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> char vehicle[5]; int car; int truck; int hrsn; //Hour the vehicle entered …

Member Avatar for zangetsuu
0
177
Member Avatar for andylbh

Hi guys, I'm trying to do a client server socket program, where the client writes a list of numbers for the server to compute, and then finally server returns a result. I've managed to get my functions working the way I want (not in client/server) But I've problem implementing it …

Member Avatar for gerard4143
0
2K
Member Avatar for gyuunyuu

I need to read words from a text file, build a structure to store the word and its occurrence. From what I was told from my TA, I need to read words, determine its size (how many chars) and allocate memory for its size. Then I need to build an …

Member Avatar for gyuunyuu
0
168
Member Avatar for nnejy

Hello, i am trying to figure out what i did wrong. i am trying to add a subtraction flag to my current 32 bit adder, and i keep getting the incorrect output back. For example, if the user enters: input 32 bits: 0 0 0 0 0 0 0 0 …

Member Avatar for nnejy
0
189
Member Avatar for negneg

Can any one help me to run this program? I am trying to modify it for multiple linear regression and use Gaussian elimination to solve the matrix.I found this in a book but it is not working:(Does anyone have anything related?I am a beginner so please something not so complicated …

Member Avatar for Software guy
0
146
Member Avatar for gaurav_13191

Hi all, I have a doubt regarding finding a loop in a linked list.I searched on internet and found 2 different ways of doing the same. But my doubt is that if a linked list has a loop, then wouldn't it be a circular linked list? If yes, then the …

Member Avatar for gaurav_13191
0
89
Member Avatar for sajidtariq

hi every one i want to ask is there any way through which i can retrieve column number of csv file using c programming. those number which are by default set in cvs file also the row name i-e A B C.............. Z AA AB AC........... thanks in advance

Member Avatar for Ancient Dragon
0
177
Member Avatar for cableguy31

I'm trying to write a simple program that takes arguments and concatenates them into a single string. It compiles fine, but when I run it, I get a segmentation fault. Here's the code: [CODE] #include <stdio.h> #include <stdlib.h> #include <string.h> main(int argc, char *argv[]) { int i; int strlen; char …

Member Avatar for cableguy31
0
149
Member Avatar for billybobjack

Hello, I'm reading data in from a serial device and I'm having trouble parsing the data into a human readable format. The serial device sends out a 75 byte packet at a rate of 3hz. Using read() I get data from the serial port as it becomes available, and write …

Member Avatar for Software guy
0
766
Member Avatar for Utsav Chokshi

Question:How many main() in one C program is possible? Answer:(a)Exactly one or (b)More than one If answer is b than write easiest program having two main()s...

Member Avatar for nezachem
0
239
Member Avatar for gaurashu

hi.. i wanna make my own library in turbo c. For this problem i have gone through net and i found something that is stated below. plz correct me where i am missing somthing. 1- make 2 file with extention .c and .h i am also confused about that where …

Member Avatar for Adak
0
156
Member Avatar for junrey laao

hi: i need to make a code for the process scheduling like round robin,first come first serve, preemptive and short job first. it should display all average waiting time for each scheduling.. and suggest what type of scheduling should be used... please help me... i need some help here...

Member Avatar for griswolf
0
85
Member Avatar for fg_aa_c

Does anyone know of any examples or tutorials for how to create a pthreads server? I have built a web server using fork() which works fine. I want to convert it to multi threading but I really cannot understand how the variables work in respect to mutexing, i don't understand …

Member Avatar for Ancient Dragon
0
106
Member Avatar for Splam Bub

Hello DaniWeb! I'm trying to return an array of strings from a function but I'm not sure how to do so. I've done the prerequisite Googling and have found people on this discussion board recommending to return char** which, it is said, can then be converted back into 2d array …

Member Avatar for Splam Bub
0
152

The End.