15,552 Topics
| |
#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 … | |
//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) … | |
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.. | |
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){ … | |
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? | |
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? … | |
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 = … | |
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 … | |
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 … | |
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??? | |
I spent 4 hours trying to find out how I can add the digits of a number. Could you give me an idea? | |
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 … | |
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> … | |
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 … | |
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 … | |
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 … | |
which programming language can i use to program the sim card and compile it with micro controler? | |
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 … | |
i know c++ and java, i want to know how to make applications using c language. | |
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 … | |
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: | |
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 … | |
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 … | |
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 … | |
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 … | |
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 { … | |
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 … | |
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. | |
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 … | |
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 … |
The End.