15,552 Topics
| |
how can i replace the array notation with pointer notation #include<stdio.h> #include<stdlib.h> #include <math.h> /* 4 */ void run_sieve(char *, int); /* 5 */ void print_primes(char *, int); /* 6 */ int main() { /* 7 */ int i, top; /* 8 */ printf("compute primes up to: "); /* 9 … | |
I'm still a little confused. Basically this is what I'm trying to do, and I'm having one hell of a time with it... My program has two values "Value" and "N". The goal of the program is to select every Nth number of Value starting with the last, and print … | |
I am looking for a project or goal to reach in order to improve me programming skills. I'd say I am still a beginner as it comes to C programming and would like a project to work on but cannot seem to think one, any ideas? | |
Hello I want to turn on a LED using C, meaning that I want to write on printer port. but the code doesn't work. I use char ledStatus instead of BYTE ledStatus. is there any difference?? what is the problem in this code? #include <windows.h> #include <conio.h> #include <staio.h> #define … | |
for the program im writing this is what i have to do: i have to write a C program that maintains a table of productID and price in a .txt file. The following menu shows the functionality of the program: 1. Display all products 2. Search product by ID 3. … | |
hi, this is the code: #include <stdio.h> main() { int m1, m2, m3, m4, m5, per; printf("Enter marks in five subjects\n"); scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5); per=(m1+m2+m3+m4+m5)/5; if(per>=60) printf("first division\n"); if((per>=50) && (per<60)) printf("second division\n"); if((per>=40) && (per<50)) printf("third division\n"); if(per<40) printf("fail\n"); } this is the output for: [root@localhost lbin]# gcc -o division division.c … | |
**I've been over this code several times but still cannont figure out why after the first time, it always prints "Add in sale? Y/N:" twice. Any ideas?** void PrintHeader(); int TotalSales(); float OverallProfit(float totalvalue, float drinkcost, int runningcost); float CalculateCosts();//Not used yet int IncentiveCheck(); //Not used yet #include <stdio.h> #include … | |
Do any one have idea of implementing the moore machine by c Programming implementation?? | |
This is a part of the question of my assignment and i am facing problems on how to access the array in a function. Write a function that finds the 2nd minimum value among the given data items of float type, and returns the 2nd minimum. You should use pointer … | |
Hi! Im very new in c programming and i have a lot of problems with this easy exercise. I have a struct for a matrix typedef struct { int dim; float **m; } t_matriu; I have a function to create a matrix and to generate random numbers to fill it. … | |
I'm applying the peterson solution for protecting memory of the critcal section. Each child process should contain a local variable that keeps track of the number of times it interrupts the other child while it is in its critical section. The process should display this value before terminating. I'm having … | |
Input a 15 character word .. condition should be terminated if enter key, space or when size limit is reached calculate average of alphabet assuming A=1,B=2,C=3.......Z=26 a=27,b=28,c=29,........z=52 print only alphabets using array of characters and using formula to check whether character is alphabet, space lowercase and uppercase you can use … | |
After much searching I cannot find a particular way to get a datafile into my structure. I understand how to create and manipulate the structure. C does not play nicely with strings is another thing I have noticed. I have tried many examples of how to do this but none … | |
A piece of C code was creating core dump. When i simply added a few fprintf statement and printed the value of variales used in code to a file, surprisingly the code ran successfully. I tried the scenario number of times and the result was same "when fprintf was present … | |
this code is working for a counter of 6 bit and i need a counter of 48 bit ... if u have time kindly try it..... i try alot but not succeed #include<stdio.h> #include<stdlib.h> #include<float.h> #include<math.h> #include <time.h> #include <cstdlib> #include <iostream> #include<stdint.h> #include<conio.h> int main() { int a[64][6]; int … | |
Can any one please help me to optimize the sieve to find the primes upto 10^8 ? I want very efficient algorithm to find all primes till 10^8 for cryptsystem. i have implemented the naive sieve which is taking too much time. please sgare some classic approach with me. i … | |
Using the code below I need to implement it such that p_poly has only one term of any degree and contains no terms with zero coefficients. I have tried to implement a temporary variable to no avail and was wondering if anyone else had an idea or possibly lead me … | |
#include<stdio.h> main() char a,m; printf("1st\n"); scanf("%c",&a); printf("2nd\n"); scanf("%c",&m); | |
want 2 print the following in c using loop |......| |..c...| |..ch..| |..chm..| | |
Hello, everyone. I am a first year IT Engineering student as well as a complete newbie to C (and programming in general). In my introductory course, I was given an assignment, which involves creating a program to get the elements of two 3x3 matrices from the user and display them … | |
This program in C finds 2 Longest common subsequence of 2 given strings(say X and Y),entered without any space on the screen individually,altering X and Y strings.I compiled and executed this above program successfully in Dev Cpp compiler as a C file(not a c++ file). | |
Hey! I'm brand new to programming in C and I am trying to practice coding by hand for my test tomorrow. I understand the basic concepts and I do have some experience in Java (not much) but I am horrible at coding by hand... anyway I am doing my best … | |
i have to do division without divison/multiplication/mod operator. how can i ? int divide(int dividend, int divisor) { int p=1; if(dividend<0) { p*=-1; dividend*=-1; } if(divisor<0) {p*=-1; divisor*=-1; } while(dividend>=divisor) { dividend-=divisor; } return dividend*p; } i have done this, but this giving time limit exceeded when input is 1234567890,1. … | |
#include<stdio.h> #include<limits.h> #define num 86090000 int a[5000000]={0}; short int s[99999999]; void sieve() { int i,j,p=sqrt(num); int k=0; a[k++]=2; for(i=3;i<=num;i=i*i) { s[i]=1; } s[3]=0; for(i=5;i<=num;i=i*i) { s[i]=1; } s[5]=0; for(i=7;i<=num;i=i*i) { s[i]=1; } s[7]=0; for(i=11;i<=num;i=i*i) { s[i]=1; } s[11]=0; for(i=13;i<=num;i=i*i) { s[i]=1; } s[13]=0; for(i=17;i<=num;i=i*i) { s[i]=1; } s[17]=0; for(i=19;i<=p;i+=2) { … | |
Hi, i have the following text file and i need to put inside a 2D array without knowing number of rows and columns in the text file. (i want C to count this also) i've tried something like that: for (int r = 0; r<2; r++) { for (int c … | |
My game is like "space invader". can someone tell me how can i move the ship at the same time i can also shoot bullets.. . TIA | |
hii i finished these topics 1.linked list 2.stack and queues.how much time will it take me to finish trees 1.binary tee 2.avl tree 3.b-tree 4.binary search 5.threaded binary tree??? actualy ill try through linked list will it be easy??? | |
hello im trying to delete a middle node in binary tree .but i have tried it in a linked list but here how to do that does any one them has links or video tutorials??????????? | |
Hey everyone need some help again with finding the min and max from a text file. its my college lab assignment. here is my code till now. #include <iostream> #include <fstream> using namespace std; int main() { ofstream fout; fout.open("Text.txt"); ifstream fin; fin.open("Lab6.txt"); float c; int count = 0; float … |
The End.