15,551 Topics
| |
#include<stdio.h> #include<math.h> int factorial( int ); int main() int n; double x,i; double value, sinx; value = sinx = 0.0; printf("Enter the value for x and i"); scanf("%lf %d", &x, &n); for( i=1; i<=n; i=i+2) { value = pow(x,i); sinx += (x - value / factorial(i)); } printf("Result - %f", … | |
#include<stdio.h> #include<math.h> int factorial( int ); int main() int n; double x,i; double value, sinx; value = sinx = 0.0; printf("Enter the value for x and i"); scanf("%lf %d", &x, &n); for( i=1; i<=n; i=i+2) { value = pow(x,i); sinx += (x - value / factorial(i)); } printf("Result - %f", … | |
Write a function for swapping players in a team. New player (which is read) enters team and replacing the player which is also read. Prototype of function is void swap(TEAM *, PLAYER, int); First argument of a function is the pointer to team, second argument is the player that enters … | |
Write a program that reads data from binary file **EMPLOYEE.DAT** (employees are proffesors and teaching assistants, assume that the file exists). Split data about proffesors and teaching assistants in two separate text files and sort data by **ID** using insertion sort algorithm. Search and print data about employee which **ID** … | |
Write an iterative function **char* conversion(unsigned int num, int base)**, that converts an integer **num** into any **base** **(base <=10)**. How to transform the following recursive function conversion() into iterative: #include <stdio.h> void conversion(unsigned num, unsigned base) { if (num / base) conversion(num / base, base); printf("%u", num % base); … | |
Write a program that reads strings(words) from a text file and copy the inverted words to another file (use the command line arguments). Form a new array of words b from original array a using the function ***void formNewArray(char **a, char **b, int n, char* (*t)(char *));*** where ***n*** is … | |
Hi Am doing my project in image procesing(text extraction from image)can u anyone send the codings for extract the text from image | |
hello, this is the part of the code I'm having a problem with if(a1==r1a || a2==r1b) {//REPLACING for(p=0;p<8;p++) { for(r=0;r<8;r++) { if( i[p][r]==1) { i[p][r]=0; } if(p==a1 && r==a2) { i[p][r]=1; r1a=p; r1b=r; } } } } I have only 2 units in the board of my chess game, intiger … | |
How do they work? Does -'0' always convert to int from char? Can it convert from anything? And same question about +'0', does it convert only from char to int, or from anything? Thanks in advance :) | |
Hello, I'm new to C language, and I'm using Visual C as my compiler.. Here's my code: #include <stdio.h>#include <stdlib.h> #include <Windows.h> int i[8][8]; void main(){ int row; int col; for(row=0;row<=7;row++) { for(col=0;col<=7;col++) { i[row][col]=0; } } printi(); getchar();getchar(); } int printi() { char s[500]; int row; int col; int … | |
Hello peopole , i want a program in c that can changes the order of a sentence unsing stack ,please can you help me ??? | |
Hello , I want to compare each element of an array with every other. For example, array[0] with array[1] , with array[2] ... Then , array[1] with array[2],with array[3] ... So , I thought something like this : for ( int i = 0; i < N; i ++ ) … | |
I've read the following statement and I cannot understand something within it "*In all binary trees, there are at most 2^i nodes at level i + 1*" what I cannot understand is that tree's levels start at level 0, however, if we apply what is written in this statement there … | |
I'm not getting the expected result when I do division. Can someone please tell me what I'm doing wrong? int page_list_size = 20; int page_fault_counter = 0; double failure = 0.0; double success = 0.0; failure = page_list_size / page_fault_counter; success = 1 - failure; printf("failure Is %lf\n",failure); printf("success Is … | |
Hello good morning...I need help on how print the heart beside each other here is the code.. #include <stdio.h> #include<stdlib.h> #include<Windows.h> int heart() { int i, j; for(i=10/2; i<=10; i+=2) { for(j=1; j<10-i; j+=2) { printf(" "); } for(j=1; j<=i; j++) { printf("*"); } for(j=1; j<=10-i; j++) { printf(" "); … | |
After you have the appropriate infix to postfix expression how would you do the math with the expression? I'm having difficulty programming it. // Operator supported: +,-,*,/,%,^,(,) // Operands supported: all single character operands #include<stdio.h> #include<conio.h> #include<ctype.h> #define MAX 50 typedef struct stack { int data[MAX]; int top; }stack; int … | |
Greetings. I would like to ask for help. Our teacher ask us to make these messages move vertically. "Merry Christmas""and" "Happy new year". I just dont know where to start..but my idea is that I will be using the for loop.Would that be possible?? | |
Hi today i noticed that this program [below] wont print the correct value and it always print 0.00000 #include <stdio.h> #include <stdlib.h> int main() { float S; int n; scanf("%d" , &n); S=1/n; printf ("%f", S); return 0; but when i asked my teacher he said you should make it … | |
hello world i would like to know to print on terminal a message with color and backround without external library i find this on internet and it works pretty fine but i would like to coloriza backround too!! #include <stdio.h> #define ANSI_COLOR_RED "\x1b[31m" #define ANSI_COLOR_GREEN "\x1b[32m" #define ANSI_COLOR_YELLOW "\x1b[33m" #define … | |
I have need to find a particular string from a text file. The user inputs the string they're looking for and the program searches through the opened text file to find that string. Is that possible? void exam() { char name[50], rollno[50]; FILE *search; printf("\t\t________________________________"); printf("\n\n\t\t\tPortal Examination"); printf("\n\t\t_______________________________"); printf("\n\tEnter Name … | |
Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not … | |
Hi All, I am new to thread programing. In below code snippet inside producer thread if return NULL statement is removed i observed programme is hanging. Usually after execution of pthread_cond_signal(&cond); i believe i am out of this thread and consumer thread already have taken proper exit after execution of … | |
Hi, I was wondering if anyone could help me or point me in the right direction. Iv been developing a source to source compiler for some time, so one language being translated to C++/C. Now the source has been translated i wish to package a windows and linux c++ compiler … | |
My question may be unclear but, can integer pointers be in any type of data structure? I mean like in a list, tree, graph, etc. Like say a linked list: struct list { struct list *next; int *some_data; } | |
Hi, I have one doubt in my mind that why below programme ended up in infinite loop if return NULL statement is commented. pthread_cond_signal will take control out of loop and gracefull exit is done from consumer thread . #include <pthread.h> #include <stdio.h> pthread_mutex_t mutex; pthread_cond_t cond; int buffer[100]; int … | |
I'm having trouble getting the parameters correct in my cat function. I would think since I'm changing temp that I would need to pass the address since I want to be able to see that in main. I think I'm getting screwed up by the decaying. #include <stdio.h> #include <stdlib.h> … | |
hi everybody im a beginner in C and im still confused with pointers so ihave a question if we consider this tiny program int a = 5 int *ptr int nptr whats the difference between those lines [below]?? what happens in memory ?? ptr = a ptr = &a nptr … | |
How would I implement the rand or the srand statement into this C Programming language. I have been reading about these 2 statements but I am a bit confused still. In need of assistance. I am a beginner in Programming.... #include <stdio.h> //Main header #include <stdlib.h> //Standard header tells the … | |
I'm having aproblem with my code, I would like to add another data up to 5 names with three grades each but I don't know how. This is my code #include <stdio.h> #include <conio.h> main() { unsigned char studname[30]; float prelim,midterm,final,average; int total; { clrscr(); gotoxy(2,4); printf("Please Enter Your Name: … | |
1.if sum is 7 or 11 its a win. 2.if sum is 2,3or 12 it a lose 3.if sum is 4,5,6,8,9,10 it becomes your point 4.to win you continue to roll the dice until you make your point.the playwr loses by rollin a 7 before making the point. requirement:develop the … |
The End.