15,552 Topics
| |
| My problem was over here: [url]http://www.daniweb.com/forums/thread93806.html[/url] After many advices, helps, I could eventually solve this problem myself, happy~~:D All I did was to write a replacement function for strcmp() and then use a bubble sort function to sort input strings in lexicographical order. Much simpler than nasty nested loops :P … |
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) … | |
| 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 … |
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 … | |
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; … | |
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" … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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" | |
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 … | |
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) … | |
Does knows any library that produces the inverse of a given matrix ? Or is there any C example available ? | |
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 … | |
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. … | |
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 … | |
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 … | |
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() { … | |
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 … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 ++++++++ * * * * * * * * ++++++++ * * … | |
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 { … |
The End.