15,551 Topics
| |
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 … | |
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 = … | |
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++; … | |
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 … | |
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 … | |
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? | |
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 … | |
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] | |
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, … | |
/* 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 … | |
How do I read data from a text file without using fscanf? | |
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 … | |
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‬‬ … | |
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 … | |
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 … | |
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); … | |
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 … | |
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. | |
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? | |
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; … | |
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) | |
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 … | |
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. | |
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 … | |
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) { … | |
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 … | |
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 … | |
[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 … |
The End.