15,551 Topics

Member Avatar for
Member Avatar for MrDiaz

Hi folks, I've been trying to solve this but I keep hitting a brick wall. Here's what I am trying to do: I'm reading a file with text in it, I am storing every letter of this file as an element of this array (this part is already done) and …

Member Avatar for Ral78
0
99
Member Avatar for tenix

Hi, I am total new in C. I have an array, then i loop it to get array elements. How can i add this array element into existing array? thank! [CODE] char arr[] = {1}; for (int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++ ) { something happend here = …

Member Avatar for tenix
0
16K
Member Avatar for vanalex

Hello everybody! I have a little problem in a piece of code that seems quite simple. This piece of code reads float numbers till the user hits the number -999.9. When he/she does then the program ends. So i write [code=c]float n; scanf("%d", &n); while (n != -999.9) { i++; …

Member Avatar for Tellalca
0
104
Member Avatar for Ancalime

I triying to write a program with array and functions. But it's realy hard to solve it with my restricted knowledge. Help me please. The problem is: Write a program where a user can insert integers to an array, find an integer (i.e. find the index of an integer previously …

Member Avatar for Aia
0
165
Member Avatar for ce0

hello all i have a problem with a "while condition" useing c. my assignment was to create a dynamical array, using malloc. i did that and all worked as it should. the only thing i dont like,is when it asks you if you want to continue, putting in integer. you …

Member Avatar for Tellalca
0
4K
Member Avatar for gameon

hello i have a problem...i want to insert a pic to my c program. is it possible to import a pic in c? if it is, how can we do it?

Member Avatar for Tellalca
0
138
Member Avatar for krap_nek

Hey guys, What I'm trying to do is a function that gets a certain array of structures and print some of the information on the screen, like the name and id_number. The thing is that some fields in the structure are repeated and my goal is to show only one …

Member Avatar for Tellalca
0
116
Member Avatar for 4erepa

I have recursive function,that i need to convert into iterative version... but can't understand how to do it - 2 hours at least :( [CODE=c] double sequence(int n) { double sum,i; if(n <= 30) return 2*n; else { for(sum =0,i = 1;i <= 30;i++) sum+= sequence(n-i); return sum/30; } }[/CODE]

Member Avatar for Tellalca
0
56
Member Avatar for Freespider

i got an assigment, for tomorow, i have a text file, and i need to convert it to binary file. text file for example: 2 - how many products ipod 1000 2 - product name, price stock playStation 23 9 i need to preper this binary file: first the size, …

Member Avatar for abhimanipal
0
106
Member Avatar for Alerwiali

/* In this program i am trying to Read these info from a text file called unsorted saved in D These info are A201456 23.15 B209356 6.58 C201232 7.5 D201172 1.2 E201653 3.68 1)i want to sort them in ascending order of the real number example (23.15 ). 2)I want …

Member Avatar for abhimanipal
-1
162
Member Avatar for rajsharma_85
Member Avatar for xaop

Hello, i have to create a program for- If the age is less than 18-You are still a kid 18-30 adult 30-60 middle age greater than 60-senior citizen else for any other impossible age (-ve or 0 age) ' wow ' Here is my attempt, [CODE]#include <stdio.h> #include <conio.h> void …

Member Avatar for abhimanipal
0
109
Member Avatar for noobuser

Hi, I want to solve a problem( to be honest its my homework ) given two string, the print the permutation in ordered form. Example: ‫‪Please enter the first string:> abc‬‬ ‫‪Please enter the second string:> mn‬‬ ‫‪Results will be: abcmn abmnc amnbc mnabc mabcn manbc mabnc ambnc ambcn abmcn‬‬ …

Member Avatar for abhimanipal
0
86
Member Avatar for speedy94519

I wrote a program that takes in this kind of input: [CODE]Short, Sue, , 3.11 Cisneros, Juan, G, 3.67 Andrew, T, 5.67 Superlonglastnamethatdoesnotfit, Betty, Boop, 2 Black, Shirley, T, 4.00[/CODE] and my program outputs this: [CODE]Highest gpa: 4.00 Average gpa: 3.19 Lowest gpa: 2.00 Sue Short 3.11 Juan G. Cisneros …

Member Avatar for nbaztec
0
116
Member Avatar for shereefatef

I have a text file with 500000 records , each record contain student ID and another index number. i insert this recors with separate function ,and i want when the user enter the student id the program get the corsponding index number and put it in avariable and use it …

Member Avatar for nbaztec
0
243
Member Avatar for xenanovich

hi, this is something i keep running into. for example, in the following example of strtok, i'm splitting a given string on a space(" ") delimiter: [code] #include<stdio.h> #include<string.h> int main() { char str[]="1234563 34 7898"; char delim[]=" "; char* result=NULL; char new[15][3]; int i=0; int j=0; bzero(new, sizeof new); …

Member Avatar for xenanovich
0
179
Member Avatar for cokaznsyco72

I'm writing this program where I have to dynamically allocate memory. So I created a function that mallocs space and does a few other things. When I try to manipulate later outside the function, I get a segfault. How do I make sure that space that I malloc inside of …

Member Avatar for Ancient Dragon
0
82
Member Avatar for HoldmysunnyD

Hello Daniweb, Could anyone please point me to an example implementation of a dynamic memory allocator that uses Segregated Fits with allocations from the front and insertions at the end? I've been trying to figure out a way to implement one, but I just don't know where to start.

Member Avatar for HoldmysunnyD
0
86
Member Avatar for chound
Member Avatar for schaden

Hi, So essentially I want to read every string in a file, then read every character in that string, find out if the string has two periods somewhere in it, and then save that string somewhere. Can someone get me started in the right direction?

Member Avatar for Narue
0
93
Member Avatar for n.cramp

Hi all, Im creating a virtual collections program at the moment, and have added a 'contextual information' panel which fades in on a button click, and then fades out when clicked a second time. Simple enough. Here's the code: [CODE] GLfloat alpha; BOOL Press[256]; GLuint GUIselect; BOOL objectInfo; BOOL scene; …

0
59
Member Avatar for james85

hi i would like u to tell me if i can make a random function to choose between four numbers and only them(-1 , 1 , -10 ,10)

Member Avatar for nbaztec
0
108
Member Avatar for MrDiaz

Hi everyone, I'm trying to accomplish the following; I need to create 2 subprocesses and each subprocess should create a process of their own. Should look like this: [QUOTE]I'm child xxxx parent xxxx I'm the subchild xxxx parent xxxx I'm the second child xxxx parent xxxx I'm the second subchild …

Member Avatar for MrDiaz
0
105
Member Avatar for farhanafzal

Write a C program to find and print the product of factorial of numbers from N to M. Can anyone please give me an idea, how to solve this Question ? Thank you.

Member Avatar for nbaztec
0
228
Member Avatar for RIsagara
Member Avatar for xenanovich

Hi, i am trying to read the contents of a text file containing a single line into a string. i'm doing this in a while loop. the text file gets updated in each run of the loop and therefore the string should contain a new value in each run. but …

Member Avatar for xenanovich
0
260
Member Avatar for Ferny84

Hey everyone, I'm trying to get this code to work... [CODE]#include <stdlib.h> #include <stdio.h> #include <stdbool.h> int allPrimes(int n) { int kiloN = n*1000; int count = 0; int i; for(i = 2; i <= kiloN; i++) { boolean hasfactor = false; int j = 2; while(j<i and !hasfactor) { …

Member Avatar for Aia
0
101
Member Avatar for didi00

Ok, guys I know that I'm asking too much questions, it's just that I really want to understand how things work. So I have a little project: Make a program in C which runs three processes (A,B,C), which use a common memory (buffer). Process A generates 50 random numbers and …

Member Avatar for didi00
0
679
Member Avatar for johndoe444

I was debugging a program and following is the snapshot: [CODE]81 while (j < len_y && suf_arr[j].word[0] == c) (gdb) 184 if (suf_arr[j].len > 1) (gdb) n 186 memcpy(temp_str, suf_arr[j].word+1, suf_arr[j].len-1); (gdb) n 187 ind = search(suf_arr, temp_str, len_y); (gdb) print suf_arr[j].word $13 = 0x7fffffff96d2 "bbit" (gdb) print suf_arr[j].word+1 $14 …

Member Avatar for UncleLeroy
0
2K
Member Avatar for saw77

[code]#include<stdio.h> #include<stdlib.h> main(){ char *tab; int n; int i; char c; printf("dimension du tableau?"); scanf("%d",&n); tab=(char*)malloc(n*sizeof(char)); printf("remplir le tableau :"); fflush(stdin); gets(tab); for(i=0;tab[i]!='\0';i++){ printf("%c",tab[i]); } }[/code] let's say i just want 5 letters in tab,so i run the program and put n=5,but what i don't get is that if i …

Member Avatar for saw77
0
211

The End.