15,551 Topics

Member Avatar for
Member Avatar for theteamdrunk

I need help with this problem. I have written the code. The function main() stores the message in an array. What I need to figure out is how to have the function restaurant accept the message as an argument(which is named menu) and display the message using pointer notation *(menu+i) …

Member Avatar for Aia
0
101
Member Avatar for woozyking

Hi, I want to write a function to perform lexicographical sorting using a simple bubble sort technique. So far I've got the basic code running, but something is not right. I can tell the algorithm is wrong but cannot fix it, please help. [CODE]int bubble_sort(char **words, int num_word) { int …

Member Avatar for woozyking
0
624
Member Avatar for Alexbeav

Hi all I'm studying C and I have to do an exercise that requires me to open a file and count the number of times a letter occurs,either small or capital. For example,I have a text file in C:\text.txt with the contents "World In Conflict".So in my example the letter …

Member Avatar for iamthwee
0
500
Member Avatar for rohit83.ken

removes comments from the given program and prints to the other file [CODE=c]#include<stdio.h> void main(int argc,char *argv[]) { FILE *in,*out; char ch1,ch2; int f=0; in=fopen(argv[1],"r"); out=fopen(argv[2],"w"); while(!feof(in)) { ch1=getc(in); if(ch1=='/') { if((ch2=getc(in))=='/') { while((ch2=getc(in))!='\n') { ; } } else if(ch2=='*') { while((ch2=getc(in))!=EOF) { if(ch2=='*') { if((ch2=getc(in))=='/') f=1; } if(f==1) break; …

Member Avatar for ithelp
0
68
Member Avatar for Alexbeav

Hi all this is the 2nd exercise I can't seem to figure out how to do.Exercise goes like this : One method of encryption is this : We pair the letters of the alphabet to the numbers 0-25. Assuming we have a text "T" and a keyword "K" of "V" …

Member Avatar for Dave Sinkula
0
143
Member Avatar for 51al

hi...my name is agus ..i'm from indonesian...i'm new here... i want to ask something... i have project but i dont know about my wrong and solutions....this is mY project [code=c] void OpenGLInit(void); static void Animate(void ); static void Key_r(void ); static void Key_s(void ); static void Key_up(void ); static void …

Member Avatar for Ancient Dragon
0
72
Member Avatar for phylon

this is a small example from the gsl example online I need to get the value from the "&evec_i.vector " into a 4x4 dimensional array such that abc[4][4]= vector elements how can I do this ? those 16 values will create the 4x4 matrix [code] #include <stdio.h> #include <gsl/gsl_math.h> #include …

Member Avatar for dwks
0
137
Member Avatar for redaqen

Hey, again... I've got another assignment coming up and I'm having issues... again. Basically, my major stumbling block is figuring out how to set the int number = returned value of enterNewNumber. Also, is there any simple way I can store the digits of an integer as seperate numbers in …

Member Avatar for redaqen
0
132
Member Avatar for rocksteady911

Hi, I'm trying to express a decimal to a binary floating point, but I'm having trouble with the normalization and what comes afterwards. So for the example of 2, we would express it in terms of binary: 10. Then normalize it to get .1 * 2^2? How can I express …

Member Avatar for dwks
0
96
Member Avatar for asilter

my program is written in c and compiled and linked with gcc. In normal way; i execute it by giving an argument after writing executable. [code] ./my_executable abc.dat [/code] and it works. i need to execute it in gdb debugger. how will i give this abc.dat argument to the gdb …

Member Avatar for dwks
0
98
Member Avatar for Justmehere

Can anyone tell me what the purpose of C functions which start with "__" ? Also another question is the same use of the "__" in defines like #define __HTTP_VERB_GET "GET"

Member Avatar for dwks
0
117
Member Avatar for Paulville

Hi People I'm a newbie in c, I learn in c++, but I don`t really know to much. A friend make a code in c, working in a linux pc. And works perfect. I normally work in Micorsoft Visual Studio, but this c code, seems not to work well (88 …

Member Avatar for Salem
0
157
Member Avatar for rohit83.ken

this code removes comments please help in correcting the code //Program to print a file by removing Comments #include<stdio.h> void main() { FILE *fp; char ch; //clrscr(); fp=fopen("temp.txt","r"); while(1) { ch=fgetc(fp); if(ch==EOF) break; else { if(ch=='/'){ ch=fgetc(fp); if(ch=='/') { while(1) { ch=fgetc(fp); if(ch=='\n') goto label; } } if(ch=='*') { while(1) …

Member Avatar for Salem
0
203
Member Avatar for phylon

Does knows any library that produces the inverse of a given matrix ? Or is there any C example available ?

Member Avatar for Duoas
0
67
Member Avatar for Narue

I've been writing my own implementation of stdio.h whenever I get a few spare minutes recently. Nothing fancy or thorough, and without wide character support, it's hardly conforming. But I was looking at one of my intermediate versions of printf and could only marvel at how ugly it was. So …

Member Avatar for Duoas
2
175
Member Avatar for Sh13

I'm having problem with storing values in multi dimensional arrays. I need to have 10 * 10 array with rows and columns. I have intitialized the array with blank spaces " ". But after this I need to store letters like 'A' 'C' 'S' on specific locations in that array. …

Member Avatar for Aia
0
264
Member Avatar for #include_rose

I'm having some trouble understanding the advantages and disadvantages of using scanf over fgets. When we have allocated memory using an array for eg, it is not wise to use scanf since buffer overflow can occur. But in what way does fgets prevent that from happening? Also, if you are …

Member Avatar for #include_rose
1
741
Member Avatar for Fredszky

Hello Im new to C programming, im trying to learn how to create a textfile with whatever name the user of the program wants. something like this, please ignore that this code wont work, its just so you might understand how i am thinking: [code] FILE *file; printf("name of the …

Member Avatar for Fredszky
0
100
Member Avatar for restrooms

pls help me on solving my project. this program isrunning but when i press enter it will be sent back to the compiler. pls help me thanks in advance [code=c] #include<stdio.h> #include<conio.h> #include<string.h> string(); int x,i,a,b,y; int stocks[5]={4,5,3,6,2}; int code[5]={100,101,102,103,104}; float cost[5]={5000.00,4000.00600.00,3500.00,7000.00}; char des[5]={'t',d',v',v',c'}; float PA ,dis,net_pay,downpayment,monthly; int main() { …

Member Avatar for WaltP
0
119
Member Avatar for locy

i try to compile this programm useing pluto,it shows me error .where schould the fehler be? [code=c] #include <"stdio.h"> int main() { int counter; int even=0; int b= 7,int h= 10; if h+ = b % 10; b /= 10; for( counter = 1; counter <= 10; counter++); { if …

Member Avatar for Aia
0
96
Member Avatar for redaqen

Hey guys, I'm a long time lurker, and first time poster. Please be kind. Anyways, for one of my classes, Principles of Algorithm Design 1, we had an assignment where we had to create a program that would encrypt and then de-encrypt a message by offsetting the characters by a …

Member Avatar for Narue
0
193
Member Avatar for csteverun

I can't find the answer to this in any C reference. The question is, is there any way to do this: [code=c] #define MAX 10; struct aStruct { int a; int b; }; typedef struct aStruct aType; aType array_of_atype[] = { {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, …

Member Avatar for csteverun
0
94
Member Avatar for Exsiss

I need to make the program: [QUOTE]Write a program to ask for a string and a single character. Read in the string using getchar(). Read in the character using scanf(). Count and report the number of occurrences of the character in the string. Add a brief comment at the beginning …

Member Avatar for Narue
0
311
Member Avatar for skyah

Hi. I was wondering if any one could help me with this program. I didn't get any error messages. It was excecuted but the output was incorrect. I got Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: 7 3 66 3 -5 22 -77 2 …

Member Avatar for ithelp
0
90
Member Avatar for Aia

You have a problem with your code. You need help. You are in a hurry. What can you do? Post for help at Daniweb as fast as you write, correct?. Wrong. The first thing you should do is to read the rules on posting and specially how to properly make …

4
2K
Member Avatar for beatlea

Hello, Is there any way of reading words from a string containg a few words separated by white spaces using a loop? I don't know how many argumets the user will input. I wanted to do it like this: [code] for(i=0;i<wordCounter;i++) { sscanf(input,"%s",argument[i]); } [/code] But this keeps reading in …

Member Avatar for Salem
0
3K
Member Avatar for skyah

I have to write an interactive program using scanf() to read in seven strings input by the user. The program should print the seven strings as a list, then sort them alphabetically and print a new list. I have to use the function strcmp() to assist in the sorting of …

Member Avatar for Narue
0
212
Member Avatar for locy

how do i write a C programm to add two figures together e.g b and h if b = 0125 and h =2354 b = 0+1+2+5 = 8 h = 2+3+5+4 = 14 and the output to be ++++++++ * * * * * * * * ++++++++ * * …

Member Avatar for locy
0
241
Member Avatar for csteverun

I could really use some help here. I can't figure out what's the problem is, so I've assumed it's all C's fault. I have a function: [code]pf_plot32(Uint32 data[], Uint32 dl, pfplot pattern[], Uint8 pl, Uint32 pr, struct pf_path32 *path)[/code] ..Which takes a pointer to a structure: [code] struct pf_point32 { …

Member Avatar for csteverun
0
205
Member Avatar for near

Hello everyone,i need help here(urgent!!): here is what my program for: 1.user will enter a string not more than 300 words. 2.change string to lowercase 3.count each word occurrence example: This is a test. This program will count number of each word occurrence. this = 2 is = 1 a …

Member Avatar for near
0
221

The End.