15,552 Topics

Member Avatar for
Member Avatar for Benfried

Hi everyone, I'm beginning to learn about progamming and I'm currently working through the seminal 'C Programming Language' which is excellent, but I have a problem regarding functions. My understanding of functions in C is that they return a value. For example: [code]x = func(a, b);[/code] ...would set x to …

Member Avatar for SpS
0
140
Member Avatar for Dabdob

Hi guys… I want to write small program in C printing three or more people in array..how? please write to me the syntax as I am very poor in C.. How to define the name? and accept the conformation from the user? Either by yes or no The printing should …

Member Avatar for server_crash
0
128
Member Avatar for nabil1983

Trying to understand how to do this Q. Can some explain using O-notation, how would i analyse the efficiency of the two algorithms below. ? Assuming that the critical operation is compute and size is the size of the array. 1) compute(a[1]) + compute(a[2]) + compute(a[3]) + compute(a[size]) 2) for …

Member Avatar for nabil1983
0
98
Member Avatar for comwizz

I am having this problem with precedence of operators. Its with the increment and decrement operators. [code] int i,j=1; i=(j++)+(++j)+(j++); [/code] this evaluates to 6 instead of 7 . Why does this happen. It would be of great help to me. Thanks, comwizz

Member Avatar for Rashakil Fol
0
171
Member Avatar for TimC

what I am trying to do is retrive the "status" back to my main prog of the status of a patient. I thought it was a simple case of S.retrieve(index of person I was looking for) and I would recive the status (which is an integer) back to my main …

Member Avatar for TimC
0
84
Member Avatar for TimC

Below I have attached 4 methods from my linked list class. 1) find 2)remove 3)retrieve 4) Insert. what I'm trying to do is write code that will let me MOVE the position of a node to another position in the linked list. Anyone got a clue?? regards Tim [code]SeqItemType Sequence::retrieve(int …

Member Avatar for TimC
0
140
Member Avatar for ferrant

Hi, I have difficulty declaring a hash_set. I would like a hash set where the key is a structure Point3d (typedef Point3D {short x,y,z}) and the value in the set associated with the key an int. I don't quite understand how to declare it ... something like hash_set< const Point3D, …

Member Avatar for perniciosus
0
142
Member Avatar for atrusmre

So I'm writing a program (MFC) that connects to a server w/ windows sockets (YUCK I know). I left it running as part of an endurance test the other day, and my PC ran out of virtual memory. Odd eh? So I ran it again using task manager and noted …

Member Avatar for perniciosus
0
520
Member Avatar for nabil1983

Hello Im trying to understand and explain how the quick sort code actually works, i unable to understand or xplain line 4 to 11. Can ne of u xplain to me briefly what those lines actually do in the code algorithm.... Apreciate ne help. [CODE]do { while(strcmp(array[i].Genre,x)<0 && i<right) i++; …

Member Avatar for perniciosus
0
116
Member Avatar for desertstorm

Hi: I had a question on how to use: int Read(char *buffer, int size, OpenFileId id); void Write(char *buffer, int size, OpenFileId id); This is for a client that is connected to a network host server and it is for a chatting program. If someone could direct me to a …

Member Avatar for jim mcnamara
0
129
Member Avatar for desertstorm

How's it going: How do you use fopen() to establish a stream to console I/O (keyboard)? What I needed to do is read in data from the console I/O and then send it elsewhere using fputs. I just don't know what the first argument for fopen("here", r) would be. Oh, …

Member Avatar for Ancient Dragon
0
305
Member Avatar for nabil1983

Hello Can someone tell me what this sort algorithm is called.? And if possible a little bit of information about it... [CODE]void record_search(struct CdRecords cdDB[]) { system("CLS"); int i; char name[20]; printf("Enter Name:"); scanf("%s", name); for(i = 0;i<datasize;i++) { if((strcmp(name,cdDB[i].Artist))==0) { ENTER DATA TO BE DISPLAYED } } printf("Press Enter …

Member Avatar for SpS
0
172
Member Avatar for Mistro116

Hello, I get the following seg fault error when I try to delete the last node of the list. Does anyone know why? My delete function and high level function are included below: The seg fault only occurs when the if value in BeginQuizFirstTry detecting that CheckAnswer is not true …

Member Avatar for Mistro116
0
102
Member Avatar for C++ programer

Dear all; i have a problem with functios. i have a program to write using struct in functions with arrays also. i have the program written in structes with array but not using the functions and i don't no who the do it with functions. if anybody acn help i …

Member Avatar for jim mcnamara
0
134
Member Avatar for nabil1983

i got the quicksort coding correct ,, the problem is that the data is still not sorting below is the complete program to the database. The data is to be sorted by genre like i have stated i have checked over and over again but cant find nething wrong... The …

Member Avatar for nabil1983
0
180
Member Avatar for free_eagle

Hello im practicing C language and i ran into this code and i can't figure out the outputs :( can u help me please ? I'm confused in operator precedence. and What does [I]short circuit evaluation[/I] means in c? when i run this code the output is: 000 and 001 …

Member Avatar for free_eagle
0
162
Member Avatar for desertstorm

Does anybody know of any sites that give a good tutorial on how to implement a chat client (console client(allows you to type in messages on the command line) and network proxy client(allows programs to connect via network sockets)) for interactions with a blackboard. Like sockets, fgets, filedescriptors...etc. The blackboard …

Member Avatar for desertstorm
0
163
Member Avatar for Valmian

Hello all, When calculating sin(M_PI) the computer outputs ~-3e-7. Unfortunately, in my program the error grows (it is multiplied by a number on the order of 1e10) into around -208. My question: is there a way to round a float/double to only 3 digits after the decimal point (I do …

Member Avatar for dwks
0
347
Member Avatar for new guy n c++

Hi i am new guy in programing and i need ur help in this program if u can. my problem is that we have to write a program to read a file usinag a struct array and a function and the assigment is Print all of the input data ; …

Member Avatar for Ancient Dragon
0
162
Member Avatar for nabil1983

Hey after spending a few hours trying to understand why my quick sort is not owrking, i've tried calling the q_sort() and quick_sort() but with no luck...... below is how i had it from the start for less confusion,, can someone tell me why it isnt working... i've checked the …

Member Avatar for dwks
0
177
Member Avatar for ehab_aziz2001

Hi, I runned that program with int variables and was OK but when I changed the type of pay_calc(),*emp_rate,pay from integer to float I failed ..Please Help main() { int *emp_no,*emp_works; int pay_calc(),*emp_rate,pay; char *emp_unit,ans,another(); system("cls"); do { input(&emp_no,&emp_works,&emp_rate,&emp_unit); pay=pay_calc(emp_works,emp_rate,emp_unit); pay_slip(emp_no,emp_works,emp_rate,emp_unit); cash(pay); } while (another()=='y'); return 0; } char another() …

Member Avatar for dwks
0
110
Member Avatar for akki_freak

Hi guys... consider this... int a[10][3]; will give us a two dimensional array. Now can we do the same thing using malloc at run time?? Think.... :D

Member Avatar for dwks
0
234
Member Avatar for nabil1983

This program is almost the same as the one last i posted but here the bubble sort algorithm is not working, i get a compiler error saying:: size of cdRecords is not known and need explicit cast to convert I cant work out what the problem is because another program …

Member Avatar for nabil1983
1
209
Member Avatar for desertstorm

I challenge anyone to code this in C language: function read_next_data(fd) data = read_async( fd ) if len(data) == 0 => Nothing to read, register to be called back when something is ready event_polling_register( fd, read_next_data ) => Go back to doing something else else => Data was available and …

Member Avatar for Ancient Dragon
0
115
Member Avatar for nabil1983

I got everything working, a couple of probls with file write. But ill work it out. I just need help on getting the quick sort working here...i got it written and even in my switch statement but for some reason it dont work....ne one know y...?? [CODE]//(Database Management System(DBMS), user …

Member Avatar for nabil1983
0
450
Member Avatar for LordJayno

I'm trying to create a graph class that is implemented as an array of pointers. This array is dynamically allocated which is where i'm having my trouble. I'm getting an error message from my equal signs saying that the operator doesn't exist [CODE]GraphClass::~GraphClass() { Node *temp; temp = array; Node …

Member Avatar for Rashakil Fol
0
173
Member Avatar for Amoris692001

I was looking for a tutorial on how to create files. I'm real new to C programming. I have to create a program which uses two files for input. I just need the create the files and then I can hammer out the rest. I know how to access the …

Member Avatar for Ancient Dragon
0
134
Member Avatar for nabil1983

Does anyone know the code to show the critical count for a quick sort algorithm. Basically my cd database is almost finished. What i need to do is show a critical count for the quicksort quicksort for my database [CODE]void q_sort (struct CdRecords array [], int count) { quick_sort(array,0,count-1); } …

Member Avatar for nabil1983
0
276
Member Avatar for akki_freak

help me with this....here i m trying to write into a file(which i have already created n saved in C:\ drive) from stdinput i.e. keyboard and then reading from that file and displaying on stdoutput....but its isn't working... :rolleyes: :rolleyes: tell me why????????? by the way i m using GCC …

Member Avatar for WolfPack
0
77
Member Avatar for ilikerps

Hello, I am having trouble with arrays. Basically, this is what happens: [code] vector <char*> constArray(10); char* changingString = "hello"; constArray[0] = changingString; changingString = "hi"; printf("constArray[0] = %s\nchangingString = %s", constArray[0], changingString); [/code] Output: constArray[0] = hi changingString = hi So, I think constArray[0] is changing because it points …

Member Avatar for ilikerps
0
119

The End.