15,551 Topics

Member Avatar for
Member Avatar for zapman2003

Hello! I am having issues with a project for my C class. We were provided the program shell (structs and the function calls) and we fill in the code for the functions. I did this, however I get a segmentation fault every time I first access my structures. Can anyone …

Member Avatar for blech
0
106
Member Avatar for lirexin

I just wondering is there any possible way to use rand() in a function to generate a random? #include<stdio.h> #include<stdlib.h> #include<time.h> int get_random(void); int main(void){ int i; for(i=0;i<=5;i++){ printf("%d\n",get_random()); } return 0; } int get_random(void){ srand((unsigned)time(NULL)); int x; x = rand()%2; return x; } I run above code and generate …

Member Avatar for [Alpha]-0mega-
0
167
Member Avatar for potato4610

[CODE]#include <stdio.h> int MyStrlen(const char *si); int main() { char str[] = "a"; char str1[] = "HELLO"; char str2[] = ""; printf("Length: %d \n", MyStrlen(str)); printf("Length: %d \n", MyStrlen(str1)); printf("Length: %d \n", MyStrlen(str2)); return 0; } int MyStrlen(const char *si) { int input; for(input = 0; *si; si++) input++; return …

Member Avatar for potato4610
0
398
Member Avatar for painejake

Well I recently got my new Mac and with previous knowledge of C# decided to start playing about with Cocoa. I am trying to make a simple application that on button press will show in a textbox or label 1 of say 5 sentences pre-coded. If anyone could point me …

Member Avatar for Adak
0
94
Member Avatar for daisuke

were having a project about turbo C programming,,, were ask to make a receipt program can you please help us how to create a code for the program.. thanks...

Member Avatar for Adak
0
66
Member Avatar for farahlyna

In C a structure is passed to a function by value. This means that the structure valued is copied for processing in the body of the function. Therefore any changes made to the value by the function would not give any effect on the value of the structure Any idea …

Member Avatar for gerard4143
0
123
Member Avatar for creeps

I'm trying to validate a day of the month, so that if the user enters a negative value or a value above 31, the program prints an error message and prompts for another day. The code below doesn't work as expected. Instead, it gets caught inside an infinite loop, printing …

Member Avatar for Adak
0
292
Member Avatar for gallantlex

Firstly, Here's my code running in VS 2010. [code=c] #include <iostream> #include <fstream> #include <string> #include <list> using namespace std; class Student { friend ostream& operator<<(ostream&, Student); friend istream& operator>> (istream&, Student&); private: int stuId; string name; int gpa; public: Student(int, string, int); int getStudId(); }; ostream& operator<<(ostream& out, Student …

Member Avatar for gallantlex
0
180
Member Avatar for harikrishna439
Member Avatar for Ancient Dragon
0
173
Member Avatar for unexpert

Hello. I'm having a bit of trouble with my programming. I'm giving a signal to my board and it will detect and display the maximum and minimum point of the signal wave. However, I'm not really sure if I wrote my codes correctly. Also, I'm getting this error : "operator …

Member Avatar for Adak
0
138
Member Avatar for Anil2447

[TEX]This is a small Program i have written to perform the Basic Operations. Here is my code for it. Please suggest to improve more.................[/TEX]3 [CODE] #include <stdio.h> #include <string.h> int main() { char operator; int num1, num2; //char operation[1]={'\0'}; printf("Enter two numbers and operator to perform calculations!...\n"); printf("Enter the operator: …

Member Avatar for Anil2447
0
113
Member Avatar for gahhon

how to reverse it? i had tried [CODE]#include <stdio.h> void main() { int i = 30; int x; char reverse[31]; char title[31] = "programming concepts and design"; for(x = 0; x >= 0; x++) { reverse[x] = title[i]; i--; } printf("The reverse order is %s\n", reverse[x]); } [/CODE] the result …

Member Avatar for gerard4143
0
232
Member Avatar for hari.sarvothama

The aim of the program is to read contents from 2 files and store it in struct variables.(This is actually a part of another program which stimulates pass2 of two pass assembler) [B]This code works fine.[/B] [code=c] #include<stdio.h> #include<stdlib.h> #include<string.h> struct optbl { char opco[10]; int value; }o_tbl[100]; struct symtbl …

Member Avatar for hari.sarvothama
0
2K
Member Avatar for gahhon

how can i use the switch statement to find a value in a range? example like, [CODE]#include <stdio.h> void main() { int monthly_sales; double monthly_income; printf("Enter your monthly sales amount > "); scanf("%d", &monthly_sales); switch(monthly_sales) { case 50000: // i want make this in a range, greater than or equal. …

Member Avatar for Adak
0
177
Member Avatar for newton_LA

C program to construct a divided difference table for f(x) = cos x based on five points which are 0,1,2,3,4. Use the coefficient ak (k, cos k). Round up to 7 decimal places. Derive p1(x), p2(x), p3(x), p4(x). Please I need any help I can get on this program. Whatever …

Member Avatar for tito4life
0
1K
Member Avatar for Danny_501

Hi all, I need to get a random number from the following: [CODE]#define RAND(min,max) ((min)+(int)((double)(max-min+1)*rand()/(RAND_MAX+1.0)))[/CODE] but when I print it out it just prints the value of min. [CODE]printf("%d", RAND(10000000,99999999));[/CODE] please help! thanks in advance.

Member Avatar for Danny_501
0
141
Member Avatar for twedel10

I need help on how to write a program that will automatically adjust circuit resistance until the maximum power is delivered to the load. The circuit will consists of a programmable power supply, a variable resistor, a fixed resistor, and a programmable load resistor. The user will enter the value …

Member Avatar for Adak
-1
115
Member Avatar for snivas519

I have written the inbuilt gets() and puts() function.... Can anyone help me to make it much more simpler...

Member Avatar for snivas519
0
233
Member Avatar for tots08

Hey guys, Just needing your help on this code. [code=c] #include <stdio.h> int main() { FILE *fin,*fout; char c; fin=fopen("input.img","rb"); fout=fopen("output.img","wb"); while ((c=fgetc(fin))!= EOF) { fputc(c, fout); } return 0; fclose(fin); fclose(fout); } [/code] I'm trying to unscramble a scrambled image and this just outputs nothing. Would you guys be …

Member Avatar for tots08
0
260
Member Avatar for jemz

hello can you help me please,my problem is that i don't know how to format numbers when the user input this 1500 it should display 1,500.00 and having total paid 3,080.00 please help me hoping for your positive responds...thank you in advance...

Member Avatar for jemz
0
114
Member Avatar for xcyrus_tan_rx

Guys will you pls help me make a calendar turbo c program? the program prompts the user to enter a month in integer form from 1-12 only (1-12 refers to month) and also prompts the user to enter year from 1980 - 2010 only if you enter an invalid integer …

Member Avatar for cutejhomz
0
100
Member Avatar for daredevil786

printf("\"My salary was increased by 15%%!\"\n"); why this prints "My salary was increased by 15%!" i think it should print %% instead of %

Member Avatar for MareoRaft
0
108
Member Avatar for Luther von Wulf

This function reformats a numeric sequence to include grouping in the usual human readable format. "123456789" becomes "123,456,789", for example. The formatting is localized to the current running machine. In a German locale the previous example becomes "123.456.789". In a Hindi locale it becomes "12,34,56,789". Printing numbers for human consumption …

1
480
Member Avatar for ftl25

Hi. I am trying to create a look up table in C. I have attempted it, but there are compilation errors occurring. Can anyone tell me what i'm doing wrong/offer any advice? I have in my header file the following: [code] struct { (void)(*function)(); const char* functionName; } lookUpTable[] = …

Member Avatar for gerard4143
0
2K
Member Avatar for cesvokamra

Hi guys, I've to develop a software to compress and extract files using the RLE algorithm. And I've decided to implement it so that if I've a set of chars like "ABRTTTTOPSSSSSNU" it will be converted as "ABR4*TP5*SNU". Now, the problem is that for example the char '*' could be …

Member Avatar for cesvokamra
0
117
Member Avatar for edbarker

I have a program which processes thousands of chemical structures. To keep track of how many are being processed, and to avoid staring at a blinking cursor for minutes not knowing if anything is happening, I included a simple bit of code: [code=c] if((MOLNUMBER%10000)==0) { fprintf(stderr,"."); } [/code] What could …

Member Avatar for edbarker
0
195
Member Avatar for Interrupt

My hobby is embedded programming therefore I’m learning C , I was just wondering if C has library functions like windows forms,buttons etc(like in C#)?

Member Avatar for $urya
0
3K
Member Avatar for srinivas88

Hello friends,I need help to create a program which converts a given dfa to minimised dfa.Not many articles or help is available on the internet and so i request your help.The program can be in any language and any input may be assumed..say for the input,a dfa is given through …

Member Avatar for Adak
0
146
Member Avatar for hfactor9

I think these req's might be impossible. 1. Upload a .hdrs file containing hundreds of thousands of email headers. All headers (each email header record) in this file contains many identical and many different header fields. These email headers are generated from Spam Reports. 2. Return all unique headers and …

Member Avatar for Adak
-1
100
Member Avatar for snivas519

Can anyone explain me the merge sort code(using divide and conquer method and recursive call)...

Member Avatar for snivas519
0
75

The End.