15,550 Topics

Member Avatar for
Member Avatar for En-Motion

I have to write a program where a user trys to pick a number. The code i've written below always exits after 2 guesses abd says the guess was correct even if it's wrong. Can anyone see what i'm doing wrong? Thanks [code]# include <stdio.h> # define NUMBER 50 int …

Member Avatar for En-Motion
0
99
Member Avatar for mikeregas

I need this to been done recursively, it works but I was told that it is not recursive does anyone have any ideas or suggestions [code=language]#include <stdio.h> #include <string.h> #define TRUE 1 #define FALSE 0 main () { char decision; char str[30]; int isPalindrome = TRUE; int choice = TRUE; …

Member Avatar for ArkM
0
140
Member Avatar for mikeregas

my question here is two fold I am new to recursion and I am not going to lie. I dont get it at all, well at least the code part. is this considered recursive? and the second question is how do I make a loop that would let the user …

Member Avatar for stilllearning
0
72
Member Avatar for patricksquare

[code=c] x=0; t=0; int t2=0,t3; while(t<=ref) {t3=t2; for(x=0;x<jbn;x++) { if(t==cpy2[x].at) { if(q>=cpy2[x].bt) { t2+=cpy2[x].bt; tt[x++]=t2; cpy2[x].bt=0; qq++; } else if(q<cpy2[x].bt) { t2+=q; cpy2[x].bt-=q; cpy2[x].at=t2; qq++; } } else break; } t++; if(t3==t2) {t2++;} }; [/code] assuming the values are cpy2[0].at==1 cpy2[0].bt==2 cpy2[1].at==2 cpy2[1].bt==3 cpy2[2].at==4 cpy2[2].bt==4 q==2 qq is just an …

Member Avatar for WaltP
0
109
Member Avatar for mikeregas

here is the code that I have so far and I can not seem to get it to work properly it is return 1 for any number that is entered. Any help that you can give me would be greatly appreciated. Thanks [code=language]#include <stdio.h> double square_root(double low, double high); int …

Member Avatar for chrissygirl
1
2K
Member Avatar for chrissygirl

hey guys, im trying to write a program recursively that takes in how many times the user wants to flip a coin, and prints out all the possibilities. i am having a hard time figuring it out. id apreciate some input. here is the code i have so far... [code] …

Member Avatar for tessen
0
251
Member Avatar for adityasaten

hi friends, First I want to introduce myselt, I am Aditya and have little knowledge of programming because I have enter in this field just os i face problem with c and need your kind solution, your reply would much valueabel for my bright future... I have a problem in …

Member Avatar for abhijeetcn
0
115
Member Avatar for J-son

Hi there ... I need help with the following program.It is giving me error. Thanks very much. [CODE=c] /*Write a structure function to enter Roll number, Name, Department, Course, Year of joining and print them out */ #include <stdio.h> struct student { char name; char dep; char course; int roll; …

Member Avatar for abhijeetcn
0
146
Member Avatar for rrreeefff

Hello, I need to modify the following function to compare with the library power using power (double, double) [code=c] #include "stdafx.h" #include "stdio.h" double mypower(float a, int n); // function prototype// int main (void) { float a; int n; int power; printf("\n enter a value of a\n"); scanf ("%d", &a); …

Member Avatar for Aia
0
73
Member Avatar for rob_xx17

hello, I'm trying to write a simple program that proves mathematical theorems (predicate calculus). What I need to do is to have a small database that holds all of the propositions ('abc'; 'b'; 'cde'; etc.). What I'm having a problem with is creating a function that would act as a …

Member Avatar for Salem
0
99
Member Avatar for rob_xx17

Hell, This might be a big vague, but I hope that someone might be able to help me. I have a program that does virtual simulation of robotic arm using inverse kinematics. The program works fine but right now I'm trying to collect some data, generated inside the program, into …

Member Avatar for rob_xx17
0
107
Member Avatar for Aus89

I am getting a the warning "assignment from incompatible pointer type" when compiling my code, I have spent ages trying everything I can think of, but I am not very experienced at using C so it is probably something really simple that I just can't see. I have commented the …

Member Avatar for Salem
0
2K
Member Avatar for simply_vheng

i need some guide.. i'm a new member here. this is my first time to ask for help. i've been working for this code for two days.. but i cant find way to make it better..huhu it suppose to do a "round robin with overhead". its an algorithm.. i think, …

0
51
Member Avatar for mgirl

Hi I'm quite new to writing programs in C language. I've been working hard on a program and my output isn't coming out as it should. Problem is you're supposed to enter 7 numbers. The program should sort the numbers in 5 categories of ages. Then calculate the average. I …

Member Avatar for grumpier
0
227
Member Avatar for DogfoodEnforcer

ive been working on the binary to decimal converter program. not having a fun time with it!! this is what i have: [ICODE]#include <stdio.h> #include <stdlib.h> #include <math.h> int main ( void ){ /* variables */ int decimalValue = 0; int counter = 0; int nextDigit = 0; char binary …

Member Avatar for Aia
0
103
Member Avatar for san_sarangkar

Hi every body , I got one problem that how can we generate 1 to n numbers without using any loop and without using recursion function ?

Member Avatar for Aia
0
147
Member Avatar for DogfoodEnforcer

Hi there Daniweb, right now im in an engineering program and we are being put through a crash course in C. Ive never dont any type of programming before so it is quite an adventure (to say the least). Currently we are doing an assignment in which we have to …

Member Avatar for Freaky_Chris
0
175
Member Avatar for anuj_sharma

hey Guys, I have completed the basic concepts of C and C++. I want to know whether should i go for file handling and database connectivity or should i go for java. Please help me on this.

Member Avatar for Narue
0
97
Member Avatar for intsoda

Hello, I am trying to capture a cd-rom eject request (both soft eject through software or physical button press.... i believe they are the same request) so that I can display a Message Box before the cd-rom tray is ejected alerting the user that an object blocking the cd-rom door …

Member Avatar for intsoda
0
108
Member Avatar for jesie0405

hi, we have this assignment in our computer subject in school. we need to create a c program that converts decimals to base(2-9) and vice versa. i know how the coversion works but i cant perfect my program. here's my program... i know the output for the 1st case is …

Member Avatar for jesie0405
0
77
Member Avatar for drameshcbe

i need the c program code for controlling trafic signal using graphics can any send the program

Member Avatar for Denniz
0
92
Member Avatar for mars key

how can i display : int x,y,p; y=10; p=3; x=y+p; printf(" sum = %d",x); in graphics mode ( graphics.h) or which function can do this job? mars key to mars and beyond Download this as a file

Member Avatar for ArkM
0
125
Member Avatar for plike922

please help... my computer moves wont work. it not an error it a crash or infinite loop. [CODE]#include <stdio.h> #include "strlib.h" #include "simpio.h" #include "genlib.h" #include "string.h" #define size 9 void main() { int rand, x = 0, i, player = 0, turn = 0, row = 0, column = …

Member Avatar for Aia
0
94
Member Avatar for Enriel10

Hi everyone! I need some help about one problem with Matlab and C. I need to convert Matlab code to C code. I have seen that there are an additional part of Matlab called RealTime Workshop that made it but is not free and i heard about Octave that probably …

Member Avatar for DavidB
0
100
Member Avatar for KDizzle

i need help programming pascal's triangle in C. i looked at the old threads, and none of them really helped. its a simple program, so no getch() or anything special. i started to create an array and give each element values. when i tried to run it, my output it …

Member Avatar for josh2
0
145
Member Avatar for badbloodyeyez

Hi, I would like to know how to determine whater a user has logged off, using a software, the software must run at the background so that the user doesnt know. Basically I want to find out if the user hits the log off button as soon as it does …

Member Avatar for badbloodyeyez
0
67
Member Avatar for windell747

Hi, I'm working on a program that models the trajectory of a baseball with drag. The program compiles okay and links okay. However, during runtime I get a segmentation fault. I remember when I was learning how to program in C several years ago that segmentation faults occur a lot …

Member Avatar for aconstantin
0
251
Member Avatar for Simplicity

Hi guys, I'm new to this forum and this is my first post :cheesy: I need help in modifying a "Snake game" program.. What I need to do is **modify the program so that when it starts (i.e. the AVR microcontroller is reset) it displays a message giving the name …

Member Avatar for waxx
0
233
Member Avatar for Clockowl

Is it possible to read a whole file at once with text files, or can I only use fgets and is that the most data I can fetch at any time? (fread() doesn't work on text files, I've experienced and then been told ;-)). Thanks in advance, PS: And suppose …

Member Avatar for WaltP
0
447
Member Avatar for rrreeefff

I am trying to write a recursive function that compute a to the n. here is as far as I have gotten as far as code [code=c] #include "stdafx.h" #include "stdio.h" int power (int n); // function prototype// main() { float a; int n; printf("\n enter values of a an …

Member Avatar for rrreeefff
0
151

The End.