15,552 Topics

Member Avatar for
Member Avatar for muhd.hadziq

#include <stdio.h> int main (void) { //declare variables int sales = 0; int totalsales =0; double commission = 0.0; //enter input items printf("\nsales: "); scanf("%d", &totalsales); //determine whether the data is valid if (sales <= 0 && commission = -1); else if (sales <= 10000 && commission = sales*0.2); else …

Member Avatar for muhd.hadziq
0
205
Member Avatar for Ankita_5

//Program to implement Basic Incremental Algorithm //Working on ubuntu #include <GL/glut.h> #include<stdlib.h> #include <stdio.h> GLfloat x0,x1,y0,y1; //Input variables taken as global int flag=1; //variable for display1() void init(void) { glClearColor(0.0,0.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,500.0,0.0,500.0); } void PutPixel(GLfloat x,GLfloat y) { glBegin(GL_POINTS); glVertex2f(x,y); //To display pixels on-screen glEnd(); glFlush(); } void display1(void) …

Member Avatar for rubberman
0
247
Member Avatar for blackrobe

Hey, I need to compile and link two C files together...what should i do to the files in order to be able to compile them as the following: [Code] gcc file1.c main.c [/Code] and then run using ./a.out... Can anyone tell me the steps please...thank you..

Member Avatar for dip_j
0
612
Member Avatar for last1devil

Hi! I'm new into C programming and Arduino. I'm trying to display some data on several 7LED Digit Displays but I get this error and I don't know why. This is my code: int iasDigits[] = {0, 1, 2}; void sendToDisplay(unsigned int device, int digits, char value, unsigned int valueLength){ …

Member Avatar for last1devil
0
242
Member Avatar for nabilmahesaniya

hey friends im a first year prograaming student and basically started with 'C' Programming so just need help are there any particular program for beginners or any website whi9ch can provides me some program to pratise and even im not abe to install "Turboc++" properly so can anyone help me?

Member Avatar for nabilmahesaniya
-1
110
Member Avatar for nitin1

void func(void * ptr) { bytearray temp(10); *((bytearray*) ptr ) = temp; } This code is not going ahead if the third line while executing while this coding is working fine. void func(void * ptr) { const char * temp = "decept"; *((char*)ptr) = temp[0]; } Why is it happening? …

Member Avatar for Banfa
0
138
Member Avatar for COKEDUDE

I have this if block that is supposed to be creating a pipe then forking and I would like to combine the while loop below it with it. How would I do that? p = pipe(pipe1); if (p < 0) { printf("pipe error"); exit(0); } else { printf("successful pipe1 = …

Member Avatar for L7Sqr
0
948
Member Avatar for COKEDUDE

I started off reading a file with fscanf. I figured I could use fscanf since the file was consistent with just two columns. I got very strange output when using fscanf. Can someone please explain why? When I switched over to fgets with sscanf it worked perfectly. I am curious …

Member Avatar for Banfa
0
1K
Member Avatar for inspire_all

Hello everyone,i think i know quick sort algorithm.But i need help in figuring out its worst case. Lets look at the below quicksort code----> void quicksort(int arr[],int low,int high) //low and high are pased from main() { int m; if(low<high) { m=partition(arr,low,high); quicksort(arr,low,m-1); quicksort(arr,m+1,high); } } int partition(int arr[],int low,int …

0
133
Member Avatar for pushkar honey

when i try to call a .c file in antother i got a error for multidecalaration of main file.i prepare for a medical shop management using c language what can i do???

Member Avatar for dhanushdee24393
0
9K
Member Avatar for Adnan S.

I spent 4 hours trying to find out how I can add the digits of a number. Could you give me an idea?

Member Avatar for sneekula
0
955
Member Avatar for COKEDUDE

Can anyone tell me why I have an infinite loop when reading from a pipe? i = 0; while(i < 10) { test_value = read(pipe3[READING], &message, sizeof(struct MESSAGE)); printf("test_value is %d \n", test_value); //printf("Entering infinite loop \n"); //printf("i is %d \n", i); //nbytes = read(pipe3[0], array, 45); //printf("nbytes is %d …

Member Avatar for COKEDUDE
0
589
Member Avatar for COKEDUDE

Is this a good example of using multiple pipes. I need to fork 3 children. Would I just need to repeat the process in between the hyphens? Where would I add extra sleeps? Is it a bad idea to use WEXITSTATUS and WIFEXITED? Can anyone spot any errors? #include <stdio.h> …

0
99
Member Avatar for COKEDUDE

I have used this several times in the past for writing to files. Is there a problem with this? I'm just writing text. I have never had any issues. What is the difference with the binary file? I thought binary files usually weren't readable. I read those two links and …

Member Avatar for L7Sqr
0
1K
Member Avatar for pooja.singh.3950

You have a block of platinum that can be exchanged in your bank either for cash or for smaller blocks of platinum. If you exchange a block of m grams, you get three blocks of weight m/2, m/3 and m/4 grams each. You don't get any fractional part, as the …

Member Avatar for pooja.singh.3950
-2
388
Member Avatar for zapman2003

Ok, so I have been trying to google the heck out of this thing to absolutely no avail and I'm really and truly stuck! The assignment, as posed to the class by my operating systems concepts teacher, was to start work on creating a file system. To begin with, he …

Member Avatar for sharawy
0
905
Member Avatar for chalobe.lefa

which programming language can i use to program the sim card and compile it with micro controler?

Member Avatar for ddanbe
0
46
Member Avatar for bitwiseboredom

So I have this programming assignment I'm doing for my structured programming class (using the C language) that gives me a segmentation fault error. I rewrote the assignment in C++ and it worked fine, but since the class uses C, I must get to the bottom of this and submit …

Member Avatar for bitwiseboredom
0
753
Member Avatar for chalobe.lefa

i know c++ and java, i want to know how to make applications using c language.

Member Avatar for Slavi
0
59
Member Avatar for kxjakkk

I'm attempting to make a C program that builds a concordance from a piece of text. I need my program to: 1. read the text consisting of one more lines from standard input. 2. parse the lines into individual words and store each word in lower case into a word …

Member Avatar for gtcorwin
0
838
Member Avatar for athlon32

This is just a little example of howto make a Gtk+ application go fullscreen. This is really useful in game programming. Please rate/comment/report errors :icon_mrgreen:

Member Avatar for Stefan_4
0
3K
Member Avatar for COKEDUDE

I am using a priority queue with a double as the priority. I am guessing this is cause so issues. I used these numbers first with no issues. 34.365681 34.481879 34.539832 36.715120 I then used these numbers and had a segmentation fault. 45.411042 40.481879 37.702110 38.951187 struct PRIORITYQUEUE { int …

Member Avatar for Schol-R-LEA
0
230
Member Avatar for COKEDUDE

I was reading this example of Priority queues and have several questions. http://matrixsust.blogspot.com/2011/11/basic-priority-queue-in-c.html #include<stdio.h> #include<malloc.h> void insert(); void del(); void display(); //How exactly do structs in structs work? Do you need to do anything special with them? Is this a //form of a linked list? Which part of this is …

Member Avatar for COKEDUDE
0
1K
Member Avatar for Ndangoh Joseph

please guys look at the code below #include <stdio.h> int main(void) { enum days {monday=1, tuesday, wednesday, thursday, friday, saturday, sunday}; enum days today=monday, tomorow=today+1; printf("\n today is the %d day of the week\n", today); printf("tomorow is the %d day of the week\n", tomorow); printf("\n today is %s and tomorow …

Member Avatar for Moschops
0
123
Member Avatar for David KBG

Good Day, I really need your help with this program. Question: FIFA 2010 Group match During the world cup, 32 of the best teams fight it out for the coveted world cup trophy. The teams are placed in eight groups of four. In each group, the teams play each other …

Member Avatar for happygeek
0
149
Member Avatar for COKEDUDE

I am trying to cast an int value in a struct to a double. I am guessing I am screwing up the parenthesis somehow. I wasn't able to find anything useful in the forum or in google. struct START { int x; int y; double heuristic; }; struct SHAPES { …

Member Avatar for COKEDUDE
0
163
Member Avatar for Iana264

Hello! Can you help me please. I am a student and i have some problems with one task. I had to write a program for an embedded system which will have 8 buttons and will show on 7-segment display the number of the button pressed last. I wrote the program …

Member Avatar for Edward_3
0
155
Member Avatar for Shofahi

Hello! I want to make an array[4][4] board and print two random characters("*" and "-" ) on it. Can you please help me? Thanks in advance.

Member Avatar for Shofahi
0
78
Member Avatar for somjit{}

The below post is just something i thought of contributing here for young( or old ) members starting out in C. In (effectively) 3 lines of code , i hope to give an intro about pointer arithmetic and how endian-ness in windows affects the output. #include<stdio.h> int main(void){ int a …

Member Avatar for somjit{}
0
421
Member Avatar for gemni7

Hi all, For my project I have to send data from dos computer to a IP address ( i.e 216.152.xx.xxx port 57. I have no idea how to accomplish this task. PC is connected to internet. I can do this using microsoft windows. But i dont know how to do …

Member Avatar for dhanupatil
0
654

The End.