19,876 Topics

Member Avatar for
Member Avatar for fruitkiwi

This code is provided as shown in below Now i would like to simplify it and hope someone can share wif me . Thanks [COLOR="Green"]Instruction User is required to enter a Roman number to be converted Decimal number. The symbols used in Roman numeral system and their equivalents are given …

Member Avatar for jephthah
0
191
Member Avatar for fruitkiwi

This is a question i copy from others,and i write the code but nid u to help figure out problem. User is required to enter a sentence in English to be transformed to Pig-Latin form. To transform a word to Pig-Latin form, the first letter of the word beginning with …

Member Avatar for jephthah
0
160
Member Avatar for tvisha

Hi all I tried to run this code on C and I m gettin this error can anyone help me solve it ? also what is an intializer in C? what does it mean when the error says in line 5 about expected intializer before C? "C:\TurboCPP\c_work\DECQDER3.C|5|error: expected initializer before …

Member Avatar for Majestics
0
659
Member Avatar for lemichelle

Hello, From within a function, I'm trying to give data to certain members of a struct that I created. The struct also has an enum type that I created in it. Say this is the struct and the enum: [code] typedef enum {cat, dog, rabbit} Animal; typedef struct { Animal …

Member Avatar for lemichelle
0
94
Member Avatar for g_loughnan

Hi guys, I haven't a clue why this won't compile! I think the compiler is confusing multiplies as pointers. Here's my code: [code=c] #include <stdlib.h> #include <stdio.h> #include <math.h> #define pi 3.14159265; double data[] = { -0.15709,-0.25413,-0.1545,-0.011505,-0.052141,-0.24125,-0.28251,0.020464,0.48291,0.69804,0.46961,0.019997, -0.26036,-0.22194,-0.059284,-0.027764,-0.14373,-0.21843,-0.14153,-0.030971,-0.060482,-0.19966, -0.217,0.037288,0.41287,0.58642,0.40239,0.036834,-0.19954,-0.1839,-0.06484,-0.042241,-0.13189,-0.18949,-0.12998, -0.044059,-0.064511,-0.16527,-0.1656,0.048371,0.35412,0.8441,0.76091,-0.086579,-0.56076,-0.38969, -0.0037447,0.066327,-0.19043,-0.35463,-0.18658,0.055369,-0.015147,-0.35243,-0.4718, -0.038401,0.66734,0.99976,0.64583,-0.038856,-0.43599,-0.32307,-0.031074,0.023928,-0.17255,-0.29875, -0.16944,0.016309,-0.037833,-0.29157,-0.36583,-0.0038886,0.56681,0.834,0.54992,-0.0043523,-0.33768,-0.2678, -0.048722,-0.0065075,-0.15722,-0.25426,-0.15463,-0.011604,-0.052198,-0.24126, -0.28247,0.020554,0.48303,0.69817,0.46973,0.020092,-0.26031,-0.22194,-0.059329,-0.027849,-0.14384,-0.21855, -0.14164,-0.031061,-0.060533,-0.19967,-0.21696,0.037369,0.41298,0.58653,0.4025,0.036919,-0.19949,-0.1839,-0.06488, -0.042318,-0.13199,-0.1896,-0.13009,-0.044141,-0.064557,-0.16527,-0.16556,0.048444,0.35422,0.84421,0.76101, -0.086502,-0.56072,-0.38968,-0.0037807,0.066258,-0.19052,-0.35473,-0.18667,0.055296,-0.015189,-0.35243,-0.47177, -0.038335,0.66742,0.99986,0.64592,-0.038786,-0.43595,-0.32307,-0.031107,0.023865,-0.17263,-0.29884, -0.16952,0.016243,-0.03787,-0.29157,-0.3658,-0.0038291,0.56689,0.83409,0.55,-0.0042893,-0.33765,-0.26779, …

Member Avatar for g_loughnan
0
104
Member Avatar for jephthah

okay, experts, i need help. i can't seem to replace characters in a file, like i thought i would be able to: here's an example code. i put print and error stuff in there to try and debug. everything seems to be working ... except that my filename is not …

Member Avatar for jephthah
0
288
Member Avatar for soosai

how to run a c programme on password checking programme parallely..thanks a lot

Member Avatar for jephthah
0
81
Member Avatar for severman

hi all could any 1 knows how to add color to printf? i mean that i want to write a sentence with color in it. thanx!

Member Avatar for zdaxxy
0
127
Member Avatar for ithelp

Can you please suggest a code optimization tool for C other than the compiler ?

Member Avatar for Narue
0
65
Member Avatar for wsn

Hi, Can someone please help me in this,,, i'm trying to write this program but i keep getting a segmentation fault . I think the problem is from the outerloop but i don't know how to fix it. I have a file for example my file contains hello world I …

Member Avatar for Ancient Dragon
0
74
Member Avatar for electromania

Hi Guys, I'm trying to read a while with the following formate 1999 43558047 2000 59068567 2001 67098709 ......................... ........................... I'm not sure how many records are in the file. Now I want to read this file using struct mystruct { double x; //this would be first column double y;//this …

Member Avatar for Ancient Dragon
0
98
Member Avatar for Nessie

Hi all The string_in function below is intended to take two string pointers as arguments and if the first is contained in the second, return the address at which the contained string begins. [CODE=C]#include <stdio.h> #include <string.h> #define TEST "This ain't a drill" char * string_in (char * str1, char …

Member Avatar for Nessie
0
116
Member Avatar for knight fyre

When is it better to use random-access ? When is it not? When is it better to use sequential-access? When is it not? So far I'm only sure to use random access in a situation where I'm dealing with a fixed number of records. For example a record of rooms …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for wsn

Hi, if i had a string (Iamhere) stored in an array of characters, and i want to get just (amhere) in another array, is there a way of doing it?? I've been reading in the string functions but couldn't figure out how this is done? Thanks

Member Avatar for Aia
0
110
Member Avatar for Drake

can anyone tell me what makes C a universal language and ideal for a number of engineering solutions? Part of an assignment would be ace if someone could give me a few pointers

Member Avatar for sDJh
0
106
Member Avatar for melystar

Hello, I'm a newbie to C. I'm trying to understand a source file about insertion sort and shell's sort, but when I try to run the programme on Microsoft VS C++ expressed edition, it always comes out with this error message! sort_main.obj : error LNK2019: unresolved external symbol _insertion_sort referenced …

Member Avatar for melystar
0
164
Member Avatar for Drake

please explain What are the following data types are and the storage requirements of each? -Char -Unsigned Char -Int -long -float -double Would be great if someone could help me out, thanks

Member Avatar for Salem
0
106
Member Avatar for coolerfantasy

Hi Guys Can Pointers In C Points To The Video Memory And Write A pixels On The Screen Or Calls Bios 10H To Do That , What About That : void far *scr = (void far *) 0xA0000000L

Member Avatar for Narue
0
153
Member Avatar for pete212

Hi, i'm a newbie to C and currently trying to learn the language, so at the moment i only really know the basic stuff. I'm trying to create a program that converts a decimal number (entered by the user) into hexidecimal. I have got it working for one single, decimal …

Member Avatar for WaltP
0
150
Member Avatar for degamer106

I'm almost finished with this program but the problem I'm having is with freeing the memory I allocated. Particularly in the area where I have pointers to strings. [CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> /////////////// user defined data ///////////////////// struct State { char * name; // state name int year; …

Member Avatar for John A
0
102
Member Avatar for one1082

I have no clue why this isn't working! Basically, I've got my tree and everything working, but now I need to fit it to the input the instructor gave me. What I need to do is read the first part of a line and then input each following term into …

Member Avatar for jephthah
0
130
Member Avatar for knight fyre

I'm trying to create a function that searches through all the beds in a hotel until it finds one that is available or just ends when all the records are searched. When it finds that bed, it updates that bed record with new information (marking it as reserved or occupied). …

Member Avatar for Aia
0
316
Member Avatar for knight fyre

I'm having a problem maintaining the data in the file. Everytime I enter a person's data the display code I have only displays the first one I entered. I'm not sure if there's somethin wrong with the creating or populating or just the display code I'm using [CODE=c]void addReserve() { …

Member Avatar for Ancient Dragon
0
97
Member Avatar for vardhani

I want to know a small c code to generate random numbers.It could be within a certain range. I want to know if rand() function will generate a random number

Member Avatar for jephthah
0
133
Member Avatar for mohanvamsi_18

How to Convert Binary String of Length 1024 to its Respective Decimal Number. for example 101 of length 3 and the respective Decimal Number is 5 10111 of length 5 and the respective Decimal Number is 23 like this .. i have a binary number of length upto 1024 ... …

Member Avatar for mohanvamsi_18
0
114
Member Avatar for modaslam

hello Can anybody tell me how to Write a C program to print "Hello World" with out using ';'

Member Avatar for Narue
0
134
Member Avatar for BstrucT

Hi all! I've looked around but to no avail... Is there any builders or apps I can download to create installers for applications written in MS Visual C#? The only option I can find in it is the 'publish' option, but I am looking for some more flexibility. Any help …

Member Avatar for BstrucT
0
88
Member Avatar for Nessie

Hello, C newbie here... below is a driver for a pretty simple function which is supposed to read in n chars from input and store in a char array. [CODE=C]#include <stdio.h> #define SIZE 81 void get_str (char * array, int n) ; int main (void) { char instr [SIZE] ; …

Member Avatar for Nessie
0
113
Member Avatar for soosai

hi im a very fresh n new user of this field... wanna know how to simulate different type of possilbilities of combinmation of number from a set of numbers and characters example.. given that to create all comnination that can be formed from the set ABC123 like combination ...? thanks …

Member Avatar for jephthah
0
94
Member Avatar for g_loughnan

Hi all, I'm trying to figure out how I can call the function estimate from the main. It takes as input: [code=c] float data[], int n, int m; [/code] and should output the float *xms and the float array float d[]: [code=c] float *xms, float d[] [/code] I don't know …

Member Avatar for g_loughnan
0
137
Member Avatar for mank

I cant seem to figure out whats wrong with this code, I am trying to generate random floating point number numbers with values from 0 to 1 with positive and negative values here is the code [CODE]#include <stdio.h> #include <stdlib.h> void populate(int generations) { int seed, ttt; seed = 456739853; …

Member Avatar for jephthah
0
133
Member Avatar for kpnprakash

hi, i want to know how to get a text file situated anywhere in my drive and to read it.

Member Avatar for WaltP
0
74
Member Avatar for Sh13

Q. Write a function Stars() whose input are an array of characters(a), the size of the array(n), and a character(ch). This function should replace all occurrences of ch in the array, a, with a star(*), and return the number of times the replacement was made. So far I have the …

Member Avatar for Sh13
0
78
Member Avatar for StithYOSHI

I'm working on a simple library to load data from .3ds files. I was working on it, and everything was working almost perfectly, when I realized that I should have been reading four bytes for each item in facelist[] and I was only reading two (code attached). I simply modified …

Member Avatar for Salem
0
79
Member Avatar for g_loughnan

[code=c] #include <stdio.h> #include <stdlib.h> #include <math.h> void estimate(float data[], int n, int m, float *xms, float d[]) int main(void) { double data[] = { //Loads(~1000) of data vavues between +1 and -1. Ex: -0.15709, -0.25413,... }; float xms[m]; float float d[m]; for (i=0;i<m;i++) { //Function call here to fill …

Member Avatar for g_loughnan
0
97
Member Avatar for sjgriffiths

hello I have the following [code=c] while(fgets(b2b_rates_address,1000,in_fp) != NULL ) { strcpy(rates_details[j].ig1, strtok(b2b_rates_address,",")); printf("rates_details[j].ig7 = %s\n",rates_details[j].ig1 ); strcpy(rates_details[j].ig2,strtok(NULL,",")); printf("rates_details[j].ig7 = %s\n",rates_details[j].ig2 ); strcpy(rates_details[j].ig3,strtok(NULL,",")); printf("rates_details[j].ig7 = %s\n",rates_details[j].ig3 ); j++; } [/code] The issue i have is this:- It works fine up to field ig3, this is due to the fact that …

Member Avatar for Narue
0
186
Member Avatar for cjw3131

im just trying to use the inputted terms in the main function. the error is: [B]hwk6.c:10: error: expected ';', ',' or ')' before '*' token[/B] [code] #include <stdio.h> #include <math.h> int getTerms(void); int term1; int term2; int term3; int term4; int term5; int main(int term1*, int term2*, int term3*, int …

Member Avatar for Ancient Dragon
0
93
Member Avatar for Majestics

I have a string , i want to give it a blink effect ... is there any specific function for it .

Member Avatar for arpit_yadav
0
143
Member Avatar for Spring_1000

Hey, I've been stuck on something all day, when I first looked at it I thought it was going to be relatively easy. I want to be able to let the user return to a menu whenever they press enter without typing anything else. I've looked on google, but I …

Member Avatar for Spring_1000
0
250
Member Avatar for Nemes

Hi, I have somewhat of a mysterious crash on my program. As far as myself and my primitive knowledge are concerned, this litterally does not make any sense at all, but maybe you guys can make some sense out of it. Basically, inside a loop, I modify a float variable …

Member Avatar for Diode
0
2K
Member Avatar for Diode

I'm trying to figure out how to parse options such as -h out of the arguments passed on the command line when the program is called. Here is my code so far. I compiled it with gcc -Wall -o options options.c and got no warnings or errors. Although, when I …

Member Avatar for Diode
0
102
Member Avatar for knight fyre

Why doesn't it work when I enter "NO"? [CODE=c] do{ printf("\n\nDo you wish to continue (yes or no): "); uppercase(fgets(progress, sizeof progress, stdin)); fflush(stdin); ((strcmp(progress,"YES")!= 0 && strcmp(progress,"NO")!= 0)?printf("\nOnly 'yes' or 'no' will be accepted!\n"):printf("\n")); }while(strcmp(progress,"YES")!= 0 && strcmp(progress,"NO")!= 0);[/CODE]

Member Avatar for jephthah
0
128
Member Avatar for hankora

here is the error I am getting _Default.CalculateFederalTax(double, string)':not all code paths return a value code: double CalculateFederalTax(double grossPay, string taxStatus) { // Calculate Federal Tax method begins // check for the Federal Tax status (Single) if (taxStatus == "S") { if (grossPay < 240) return grossPay * 0.12; else …

Member Avatar for dilkash2007
0
144
Member Avatar for mreply

hi, can u tell me y linker gives error when we try to define a variable in a header file and include this in more than one source file? [code] /*test.h*/ int i =0; /*1.c*/ #include "test.h" i++; /*2.c*/ #include "test.h" i++; [/code] whereas the same works fine if i …

Member Avatar for Salem
0
276
Member Avatar for modaslam

Hello Geeks, I am working on a program for date,month calculation. I found this code used to convert to Gregorian format for calculation. It would be great full for me if anybody can explain this ... like 0.75 yy/4 .4*mm what are these constants why m-1, yy-1 etc.. [CODE] long …

Member Avatar for modaslam
0
150
Member Avatar for Diode

I don't know about C, but I read that C++ doesn't have any "standard" library for networking stuff. I was wondering which libraries for C were more popular or higher acclaimed. And who better to ask than the experts themselves? Many thanks in advance diode

Member Avatar for Diode
0
113
Member Avatar for Tom21

I have write a code to read data from a file and i try to put it in a queue but i don not know who to put in th queuue.IS anybody who can give an example??? my code is bellow: [code=c] if((fp=fopen("read.txt","r"))==NULL){ printf("\nERROR OPENNING THE FILE"); exit(1); } while(fgets(line,100,fp)) …

Member Avatar for jonnelgrande
0
75
Member Avatar for Mr.UNOwen

Hello, Before I switched to Ubuntu, I used to have some cool boot screens for windows and now I want to create some for Ubuntu, but I have no clue where to begin. What I do know: - text input and output in C - animation in Java - using …

Member Avatar for Crushyerbones
0
85
Member Avatar for modaslam

I have some question on structure padding Can any one help me! Structure padding is done for alignment(is it right) 1. Why is it to be aligned? [CODE] 2. struct sfoo { int a; char i; } sizeof(struct sfoo) = 8 // 4+1+3(padding) struct sfoo { //int a; char i; …

Member Avatar for modaslam
0
370
Member Avatar for nelsonsu

when i running this program, i've found that one of the used integer always over load. that is int outq. could someone please help me find out what's make this integer over load at last? thanks. [code=cpp] #include <stdio.h> #include <stdlib.h> #include <time.h> #include <fstream> #include <iostream> #include <string.h> #include …

Member Avatar for nelsonsu
0
156

The End.