15,551 Topics
| |
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 … | |
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 … | |
[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 … | |
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 … | |
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... | |
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 … | |
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 … | |
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 … | |
How to delete array elements by using it's subscripts in C language? | |
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 … | |
[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: … | |
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 … | |
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 … | |
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. … | |
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 … | |
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. | |
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 … | |
I have written the inbuilt gets() and puts() function.... Can anyone help me to make it much more simpler... | |
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 … | |
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... | |
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 … | |
printf("\"My salary was increased by 15%%!\"\n"); why this prints "My salary was increased by 15%!" i think it should print %% instead of % | |
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 … | |
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[] = … | |
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 … | |
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 … | |
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#)? | |
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 … | |
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 … | |
Can anyone explain me the merge sort code(using divide and conquer method and recursive call)... |
The End.