15,551 Topics

Member Avatar for
Member Avatar for Mattpd

I am trying to take a user's input and assign it to a certain part of a structure. This code is in my book so I assume it's correct: [code] scanf("%d", &part_number); inventory[num_parts].number = part_number; [/code] I need to do the same thing but with a string instead of a …

Member Avatar for Mattpd
0
133
Member Avatar for abd2

hi, this is the code for switch:[CODE] include <stdio.h> main() { int i=2; switch(i) { case 1; printf("i am in case 1\n"); break; case 2; printf("i am in case 2\n"); break; case 3; printf("i am in case 3\n"); break; default; printf("i am in default\n"); } }[/CODE] and this is the …

Member Avatar for mrnutty
1
153
Member Avatar for Mathura

Dear colleagues I am currently working on designing a scheduler using Borland C. I am struck with the concept of interrupts. I am trying clock tick interrupt for task switching. In all materials they say you will continue to your regular job until the interrupt occurs. I don't think it …

Member Avatar for Mathura
0
125
Member Avatar for Vitriolics

Hey, I have a program that it supposed to read two columns of data and then perform a calculation on them. The problem is reading the data in from the file. I have a function to count the lines, this works correctly. It returns it's value into a variable called …

Member Avatar for Dave Sinkula
0
120
Member Avatar for pdk123

In the following c code, the num_elements is gobal. But if i make it as local and return , it gives strange value just before return it becomes '0' ...can anybody explain why ? [code] int num_elements =0; //generates a psuedo-random integer between min and max int randint(int min, int …

Member Avatar for pdk123
0
201
Member Avatar for AndrewYY

I've got a large array of coordinates (a struct containing x and y, among other things) and for each pair of coordinates, I'm trying to find another pair that's closest to it from that array. [code] int i, j, d = 0, cd = 0, closest; for(i=0;i<size;i++){ closest = 0; …

Member Avatar for mrnutty
0
110
Member Avatar for schicksalf

Hello I need help to write a c program that prints a laon amortization schedule when user imputs, principal, annual percentage rate of interest, number of years to pay off the loan and monthly payment. original loan amount=10,000 number of payments is 36 APR is 7.50 payment is 311.06 monthly …

Member Avatar for Ancient Dragon
0
171
Member Avatar for Rsh>>>

[CODE=C] /* This program returns a run time error as follows: "Your code has stopped its execution with a non-zero (failure) exit value.This is generally due to run time Exceptions like Memory Access Violation and Floating Point Exception. Please check your code for run time Exceptions and try again." PLEASE …

Member Avatar for Ancient Dragon
1
87
Member Avatar for kirtics344

Time limit : 10 secs. (The program must produce output for all test cases within the stipulated time) A spaceship carrying a convention of high ranking officials had a close shave with a meteor. They are now scattered over the surface over a meteor and the spaceship is beyond repair. …

Member Avatar for coolnik
2
88
Member Avatar for D_switch

im using borland [CODE]/*Write a function that will scan/read each line of a given text file and determine whether a line is valid or invalid. A line is said to be valid if and only if it satisfies the ff: a. the line is composed only of characters a and …

Member Avatar for gerard4143
0
115
Member Avatar for Iam3R

Hi , I read that c is not a block structured language. means it does not allow defining functions inside other functions. but this code is not generating any error not even warnings, though we nest the functions. whats the story. [CODE] #include<stdio.h> int main() { int num; num = …

Member Avatar for Aia
0
91
Member Avatar for Iam3R

Hi i have written a program to check the precision of float and double values. i read that the precision of float is 6 digits and double is 10. but it is showing only 6 for both. do we need to make any arrangement for the system to print the …

Member Avatar for Iam3R
0
494
Member Avatar for fedya

Hello guys, I've got a question related to my data structures class. I have file in which data is unordered. Say: hello apple blue phone number I have to search a string using Binary Search. But since we cannot apply Binary Search to unordered list, we should make an ordered …

Member Avatar for mrnutty
0
75
Member Avatar for Ahmed Helmy

Dear all, I practice a program about "stack by linked list" and I found this error [COLOR="Red"]"suspicious pointer conversion"[/COLOR] in the part of defining "push" and "pull" function. Thank you in advance. Ahmed Helmy ITI student.

Member Avatar for Ancient Dragon
0
24
Member Avatar for ganmo

Hey, I am currently following a code skeleton to implement the missing code for some function. Below is only some part of the implementation I've done so far. Yes it is not much yet... I got stuck for the implementation of the [B]list_add()[/B] function. What I want to do there …

Member Avatar for ganmo
0
102
Member Avatar for imagine88

Logic Used: Insert Pixel Data into a struct containing RGB values of the pixels read Data in a 3x3 array: | BGR(-1,-1) | BGR(-1,0) | BGR(-1,1) | | BGR(0,-1) | BGR(0,0) | BGR(0,1) | | BGR(1,-1) | BGR(1,0) | BGR(1,1) | Assign Average of all Blue,Green,Red components respectively to another …

Member Avatar for death_oclock
1
152
Member Avatar for onruli

I am a new person to c programming but i know some of its fundamentals if someone could help me out in this program it would be of great help. The program is to read a positive integer number n, and perform the squares of individual digits. For example n=205 …

Member Avatar for Narue
0
34
Member Avatar for onruli

I am stuck in this program for the last 5 days please help me out.The output which I had got is entirely different from the desired output.Please its urgent The program is to read a positive integer number n, and generate the numbers in the following way. (eg: if the …

Member Avatar for Narue
0
44
Member Avatar for Mattpd

Sorry, solved my own problem. [CODE] #include <time.h> time_t current = time(NULL); char date[11]; strftime (date, 11, "%m/%d/%Y", localtime (&current)); [/CODE]

0
68
Member Avatar for rel0aded911
Member Avatar for Ancient Dragon
0
78
Member Avatar for DavidBrown1

I need help in Graphic programming in C. I donno how to start. I use Visual C++ compiler which doesn't support <graphics.h> Please somebody help. I can't find anything!:sad:

Member Avatar for William Hemsworth
0
86
Member Avatar for patrickkonsor

Hello all, I'm working on a school project (in C) that I'm having some issues with. I have a number of threads which recursively send information between one another via sockets. The structure for the recursive case is as follows.. Loop For A Long Time { Receive From Predecessor Respond …

1
57
Member Avatar for John-5-

Hi i'm having some trouble getting my head around this assignment... which is : Design, write and test a program to print a table of factorials. The program should read in two values: a maximum factorial value and a minimum factorial value. It must then print a table, as illustrated …

Member Avatar for mrnutty
0
127
Member Avatar for 9868

Hello everyone, Here's my code for making a dynamic array(the user inputs the size of the array). It's working fine but I think that I've not made the best code. Is there any suggestion for improvement or optimization? [code] #include <stdio.h> #include <stdlib.h> int main(void) { int *p; int n,i; …

Member Avatar for Narue
0
90
Member Avatar for applesplz

Hey everyone, I am stuck on the last function of my problem, could someone help me get started by helping me on the first part of function? Question: I need to write a random function to get 2 numbers from 1-6, and needs to be in a loop 25 times …

Member Avatar for Ancient Dragon
0
43
Member Avatar for amr123

Hey guys, i am writing a couple of programs but I have some problem with the basic one... can you please provide me with a 24 hour clock which has hour, minute and second? also it should have the ability to set the time.. your help is highly appreciated...it is …

Member Avatar for Ancient Dragon
0
185
Member Avatar for Iam3R

hi , i have read that c99 introduced: inline,_Bool,restrict,_Complex,_Imaginary i have used _Bool here but do no how to use remaining all please any one used the above can help me. [CODE] int main() { _Bool b; b=true;// giving error true undeclared ,cant i use that way // with out …

Member Avatar for Iam3R
0
2K
Member Avatar for Jelmund

Hello people :) My teacher gave me a new project to work on. I need to write an application that output all the letters of the alphabet in a random order. I've made some applications before but im still kinda new to this. Could any of you give me a …

Member Avatar for zortec
1
231
Member Avatar for smnadig

Hi All, I am facing a problem with using the function [B]strtok()[/B]. Following is just a sample code. The code below stores the string [B]str[/B] delimited by comma into an array. I want to modify the code below so that array would contain an empty space/new line if a value …

Member Avatar for ABuNeNe
0
226
Member Avatar for ahamed101

Hi All, Let me explain the problem. I have multiple include files as in class1.inc, class2.inc, class3.inc etc. Contents of an include file will be like class1.inc [code=c] { "john", 12, 68, "steve", 12, 98, "mat", 12, 95, }; [/code] This will basically serve as a static array of structures. …

Member Avatar for gerard4143
2
1K

The End.