18,491 Topics

Member Avatar for
Member Avatar for perksexcuse

Hello DaniWeb! I've found your website very useful for previous problems in my course, but this time I've come across something I just can't figure out. I'm attempting to create a program thats instructions are defined in the code. I've used a previous post as a guideline, and it was …

Member Avatar for perksexcuse
0
184
Member Avatar for Lilcrew

I need to create a rectangle using for loop and a nested for loop So far the code I've got is: [code]#include<iostream> using namespace std; int main() { int row, i, width, spaces; cout <<"Enter the number of rows: "; cin >> row; cout <<"Enter the rectangle width: "; cin …

Member Avatar for mrnutty
0
150
Member Avatar for dina154

[CODE]// Randam Guessing Game #include <iostream> #define NEWLINE "\n\n\n" #include <cstdlib> // need to use rand() function #include <ctime> using namespace std; /*void Start(); void GetResult(); void HighScore(); int a, b, chance, maxrand; char difficultychoice, menuchoice, diffchoice; void Start() { a = 0; b = 0; chance = 0; maxrand …

Member Avatar for dina154
0
2K
Member Avatar for illIAm

Hi i got this progamm working fine it is supposed to read a comma delimited text file store as an array and the output a formatted version The problem is its outputting something really weird I dont know why. [B]The text file it is supposed to read[/B] [code=text]Darwin,3,33 Darwin,1,11 Darwin,6,66 …

Member Avatar for Narue
0
232
Member Avatar for Peter4n31

I am quite desperate about a random crash. The memory could not be "read" error. I would be very happy for any help. Thank you. [CODE]HRESULT CSceneNode::UpdateAll() { D3DXMATRIX backup_local_tm = ei.world_tm; Update(); SceneNodeIterator begin=FirstChild(); SceneNodeIterator end=LastChild(); for (;begin!=end;begin++) { (*begin)->UpdateAll(); // Here is the random Crash !!! } ei.world_tm …

Member Avatar for Peter4n31
0
211
Member Avatar for localp

Hello, i have written a code in 'C' using visual C++, and i was able to create a DLL out of it. Now i need to access a method of this DLL, from my C# Main() method. How do i do this? The steps that i followed so far; 1.) …

Member Avatar for localp
0
182
Member Avatar for happyhappyhappy

Hey guys, I am interested into making a 3D tic tac toe game, but right now I am stuck. I created a 3D string... like board[3][3][3]. and each time the user type in numbers between 0 to 2...and the computer does the same too. I played a few 3dTTT game …

Member Avatar for Salem
0
169
Member Avatar for localp

I am new to C, hope someone could help me here. I need to implement a keystroke, for example, i need to programatically implement the 'return key'. As in if someone is pressing the 'return key' from the keyboard. but here, the user will not even touch the keyboard. the …

Member Avatar for localp
0
190
Member Avatar for Nicco

Hi there, I'm working on a map for a class assignment and running into trouble. I've tried looking around the web but couldn't find anything that helped. I know how insertion works on a basic level when returning a node pointer but think i'm missing some key ideas when using …

Member Avatar for Nicco
0
2K
Member Avatar for metal_man

Hi to all. It's my first post here. I want to ask about 2D Gabor filter implementation. I have some code but it is not working. So let me present my work first: [code=c]signed int sumX, sumY; long int SUM = 0; int I = 0, J = 0; double …

Member Avatar for TrustyTony
0
505
Member Avatar for DOT6

Hello all, I have been working on a card game for the last month or so and sofar have created the basics ie. cards, deck... The language is ANSI-C and is created in programmers notepad with devkitpro and MLlib. Everything is working greate so far as in I can shuffle …

Member Avatar for Narue
0
268
Member Avatar for super.mina

The user enters the following : " x+sin(x)-pow(x,2)+5log(x)" How can I make parsing for a statement like that .

Member Avatar for WaltP
1
148
Member Avatar for bufospro

Hi, I am trying to make a program which reads 6 integers , insert into a file numbers1.txt then copy numbers1.txt content to numbers2.txt and finally print numbers2. The problem I have is that when I am trying to copy the file to another the system crashes. My code is …

Member Avatar for WaltP
0
94
Member Avatar for apan

Is there a reliable method to extract the quantized DCT coefficients of a jpeg image? I can see that there is the jpeglib for manipulation of jpegs but I am wondering if someone has already used it and does the job I want to do. To extract the quantized DCT …

0
148
Member Avatar for fantasma

Greetings, I've got a working flex/bison parser that I would like to run from an exe file. However, I can't find the knowledge to achieve that. Do I need to create a C file, with an exec function to call the files? If so, what files do I call in …

Member Avatar for fantasma
0
390
Member Avatar for montjoile

Im trying to implement a btree. I don't have any error in compiling, but when I run my code I have some weird runtime error. It says something like: MALLOC c:3096: sYsmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size …

Member Avatar for montjoile
0
399
Member Avatar for reza.adinata

Hi all, I am new in C programming, currently learning about linked list. I know that there is a lot of examples about linked list, but I decided to write my own code, to make me more understand. I managed to build a linked list, insert a new node after …

Member Avatar for reza.adinata
0
423
Member Avatar for Slavrix

hi can someone give this a quick look over and tell me where im going wrong [CODE]#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> void main() { struct Rainfall{ char city[20]; int month; int rainfall; }; Rainfall Rainfallarray[18]; int count=0; FILE * readfile; readfile=fopen("CityRain.txt","r"); if(readfile==NULL) { printf("CityRain.txt failed to open."); exit(1); } printf("CityRain.txt Opened\n"); …

Member Avatar for Slavrix
0
152
Member Avatar for chhabraamit

HI, I am looking for faster input and output method for the C other than just normal scanf and printf modules. Please elaborate by simple example. thanks :)

Member Avatar for Narue
0
342
Member Avatar for captalex

i have written code to move a dot from on end of the lcd screen to the other end. [CODE] /*move dot across the creen with pixel increments of 10*/ for(x=10;x<120;x+=20) { Glcd_Dot(x,y,0); Glcd_Dot(x,y,1); Glcd_Fill(0); delay_ms(100); } [/CODE] i have seen examples in C, but this is on a 128x64 …

Member Avatar for andrewll2
0
539
Member Avatar for whitelite

i want to make rot13 encryption this program convert ascii code from a caracter, and work only with uppercase character (65-90) please help me [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> void rot13(const char *input); int main(void) { char *input; printf("Enter string (max. 255 characters) : "); gets(input); printf("\nConvert result %s …

Member Avatar for andrewll2
0
269
Member Avatar for merse

Maple printf using the same format system as C %g %g puts two numbers but lot of spaces are between them it is possible to eliminate the spaces? %-g is not good, why?

Member Avatar for DavidB
0
92
Member Avatar for LesterTheGreat

Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine …

Member Avatar for Schol-R-LEA
-1
255
Member Avatar for goyofoyo

so I am in the process of creating a lc-3 compiler that is written in C and I am stuck on how to convert the BR command into C language, the assignment asks that i get a file and then spit it out in zeros and ones , but with …

Member Avatar for TrustyTony
0
298
Member Avatar for Soubhik

Hi Say I want to write a header file as an exercise. It will contain a bunch of functions and some constants. Q1. I noticed that the standard header files only contain the function prototypes. a> Where are the actual functions? b> How do I write a header file such …

Member Avatar for Soubhik
0
235
Member Avatar for CloudZELL91

what is the program of do while that ... you can type any number but when u type zero it will stop the program? thanks for the help peace!

Member Avatar for CloudZELL91
0
105
Member Avatar for dgreene1210

[CODE]#include <stdio.h> void getInput(); void calculate(int num1, int num2, int num3, float num4); void printTable(int num1, int num2, int num3, float num4,int calc1, int calc2, int calc3, int calc4, double calc5, double calc6, float calc7, float calc8); int main (void) { int num1, num2, num3; float num4; int calc1, calc2, …

Member Avatar for dare599z
0
1K
Member Avatar for beatbox32

Hello, I'm attempting to learn C through the K&R book and am having some trouble with Exercise 1-13 at the moment. I'm just attempting to do a simple horizontal graph and can't figure out why this isn't working correctly. It seems to be ignoring my first "if" statement and just …

Member Avatar for beatbox32
0
523
Member Avatar for CloudZELL91

help!.... can you give me a statement of looping that use for loop, while, and do while loop at the same time... and if you can answer the statement it will be more welcome.. thank u ... peace!

Member Avatar for Momerath
0
81
Member Avatar for garap
Member Avatar for Narue
0
50
Member Avatar for Dhanesh10

[CODE]#include"stdio.h" #include"conio.h" #include"alloc.h" struct node { int age; char name[25]; struct node * next; }; void add_end(struct node **q); void display(struct node *); void main() { struct node *p; p=NULL; add_end(&p); //display(p); getch(); return; } add_end(struct node **q) { struct node *temp,*r; temp=*q; if(*q==NULL) { temp=(struct node *)malloc(sizeof(struct node)); printf("\nEnter …

Member Avatar for Dhanesh10
0
396
Member Avatar for VernonDozier

I have the following code. It's a memcmp implementation for the Renesas R5F Embedded Chip family and I'm trying to test it. [code] #include <stdio.h> #include <time.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> #include <stdlib.h> #include <assert.h> typedef char SInt8; typedef unsigned char UInt8; SInt8 one_net_memcmp(const void *vp1, const void …

Member Avatar for VernonDozier
0
229
Member Avatar for VernonDozier

[code] #include <stdio.h> #if 1 //! Set Pin string const char* const ONCLI_SET_PIN_CMD_STR = "set pin"; #endif const char* const SINGLE_APP_STRINGS[] = { ONCLI_SET_PIN_CMD_STR }; int main() { printf("%s\n", SINGLE_APP_STRINGS[0]); getchar(); // pause return 0; } [/code] Line 12 Error message... [code=text] 12|error: initializer element is not constant 12|error: (near …

Member Avatar for VernonDozier
0
345
Member Avatar for TomaCukor

hello ! i have a program id like to code , and it uses from 3 upto 15 members of a structure , id like to ask , [COLOR="red"][I]1,[/I][/COLOR] is there a way to not define all members of a structure at the start but add members as needed ? …

Member Avatar for Schol-R-LEA
0
157
Member Avatar for ricardo.crudo

Hello Everybody. I'm with a classic problem in C preprocessor concatenation. This is the situation: [CODE] #define BAUDRATE(VAL) (B ## VAL) //... const uint32_t BAUDRATE_VAL[] = {1200, 2400, 9600}; //... br = BAUDRATE(BAUDRATE_VAL[i]); //... [/CODE] This code, result in the error: BBAUDRATE_VAL undeclared I need that the result of concatenation …

Member Avatar for Narue
0
100
Member Avatar for anjoz

im trying out using malloc in array of characters by reading each word from that text file and putting it in a array so the array size is exact my problem is when i run the program it makes segmentation fault im not sure where the problem is and if …

Member Avatar for Narue
-1
578
Member Avatar for rminator

In fact I had a logfile, that I decoded, by reading his contents byte after byte and save it in a Byte Array. And there after I converted my array of byte in hexadecimal value, and Save it in a stringbuilder. But now my problem is the following, how to …

Member Avatar for oredigger
0
768
Member Avatar for jenny666

Hello im makin a program in C tht will query my database when i use the following code i get an error "segmentation fault" [code] //retreive configuration items from the mysql database mysql_query(conn, "SELECT callcost FROM imds.testset Where callcost BeTWEEN 900 and 1000;"); results = mysql_store_result(conn);[/code] even when i use …

Member Avatar for Salem
0
307
Member Avatar for bbman

hey can anyone convert this c code into c# [CODE] #include<stdio.h> //Assume following return types while writing the code for this question. int output1; void GetBuildingCount(int marineCount,int marinePositions[][2]) { int x,y,i,j,temp; for(x=0; x<marineCount; x++) { for( y=0; y<marineCount-1; y++) { if(marinePositions[y][0]>marinePositions[y+1][0]) { temp = marinePositions[y+1][0]; marinePositions[y+1][0]=marinePositions[y][0]; marinePositions[y][0] = temp; } …

Member Avatar for zmeditation1
0
123
Member Avatar for stavros141

Hello there, I recently decide to learn and code Windows Services, After I learned the bare basic I thought I would make a program that logs the users program usage every 60 seconds I have coded the same thing without putting it in a service but apparently Services work differently …

0
129
Member Avatar for vedro-compota

Hi ,programmers! Please tell me why it's possible to use such condition - [CODE][U]if (!fork ( ))[/U] return 1;[/CODE] as I know the fork() returns pid_t-type but at the same time "if" needs boolean.. big thanks in advance)

Member Avatar for vedro-compota
0
188
Member Avatar for breatheasier

Hi, I was wondering what libraries there are out there to do some simple sound generation. For example sine waves, square waves etc.. I'm on Linux, so no Microsoft stuff please.

Member Avatar for jbennet
0
177
Member Avatar for nocloud

I have a class that looks like this [CODE] //the mem_data class======================================// class mem_data { public: mem_data(int,int,std::string); ~mem_data(); private: std::vector<reader> mem_store; int complete; friend class model_base; }; [/CODE] Now, I would like to let the class model_base access mem_store My main code will contain the following: [CODE] mem_data test_data(20110601,10,"test_file.csv"); model_base …

Member Avatar for nocloud
0
979
Member Avatar for megha10

In the below snippet,Rewind() wraps up the file but still the no of records exceed the MAX value set. if(no_of_msg_records >= MAX) { rewind(fp_msg); no_of_msg_records=0; } ie the no_of_msg_records in the file exceeds MAX value.

Member Avatar for abhimanipal
0
109
Member Avatar for anjoz

Ok heres my problem the code is working fine but i cant read extended ascii characters i got a tip that the problem is that extended ascii characters are 16 bits not like the original 8bits per character i dont know where to start can you gets give me tips …

Member Avatar for abhimanipal
-1
1K
Member Avatar for illuminatus89

[CODE]#include<stdio.h> #define UN_IN -1 #define COL 10001 #define ROW 5000 int main() { int r,c; long int a[ROW][COL]; for (r=0;r<ROW;r++) for(c=0;c<COL;c++) { a[r][c]=UN_IN; // b[r][c]=UN_IN; } printf("%d %d", a[34][56],a[12][67]); getch(); return 0; } [/CODE] I was solving a problem which required large input. Am using a two dimension array but …

Member Avatar for Narue
0
131
Member Avatar for literal

[CODE]int i, j; for(i=2;i<1000;i++){ for(j=2;i/j;j++){ if(!(i%j)) break; if(j>(i/j)) cout<<i<<" is prime\n"; } }[/CODE] Can somebody experienced clear me how this program actually finds prime numbers... The line with the last if condition confuses me most -> j > (i/j)

Member Avatar for Distantearth
0
192
Member Avatar for reza.adinata

Hi, I am new in C, trying to create a simple C file, that assign a value for a struct member with the type of string. I can't figure out why it said error : string.c:20: error: expected expression before ‘{’ token, but I don't find any syntax error.. [CODE] …

Member Avatar for reza.adinata
0
234
Member Avatar for shimooli

I''ve got a struct like this: struct Node { int n; Node *left; Node *right; } I build up a binary tree from this struct. Now, how can i save the binary tree onto the hard disk, and how can i rebuild it from the hard disk ?

Member Avatar for Narue
0
214
Member Avatar for illuminatus89

[CODE]#include<stdio.h> #include<conio.h> #include<stdlib.h> struct a{ char *c; int b; }t; int main() { scanf("%s %d",t.c,&t.b); printf("%s",t.c); getch(); return 0 ; }[/CODE] I guess there is some problem in receiving input (more precisely in t.c part). Further assistance will be appreciated.

Member Avatar for illuminatus89
0
144

The End.