19,876 Topics

Member Avatar for
Member Avatar for saamsonn

I'm trying to write a code to take an image as argv[1] and save it in a new file "argv[2]" with the image flipped upside down, but my output does not open with any image viewer here's my full code. some one help me out please #include <stdio.h> #include <string.h> …

Member Avatar for BobS0327
0
3K
Member Avatar for jcmoney1010

I'm trying to search a string array of names and return an integer to the main depending on if the search was successful or not. for example if the user entered name didn't exist it would return -1 and I can tell the user the name is not listed, but …

Member Avatar for Adak
0
181
Member Avatar for jcmoney1010

I'm writing a program that is supposed to take in a list of names from the user, store them in an array, and then search through the list to check and see if the next name the user enters is part of the original list of names. The issue I'm …

Member Avatar for jcmoney1010
0
164
Member Avatar for nitin1

what are they trying to say in this paragraph , I have read it 10 times, but not getting what they want to teach me here: link is this. : http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers and the para which is just before the euler totient theorem. am copying here also. *Or consider a scenario …

0
86
Member Avatar for chipbu

Hi guys, here I have a code snippet that I tried to run for 2 days without any result. There is something wrong with fread function. When debugging, it doesn't read all the file that I need Here is the link to the file http://www.math.umbc.edu/~rouben/2003-09-math625/images/reese_witherspoon.pgm In main: #include <stdio.h> #include …

Member Avatar for BobS0327
0
274
Member Avatar for bemo55

I have a project for school that i am working on, and i cant figure out how to store names in an array. i have it declared as [code] char firstname[25]; char lastname[25]; [/code] but i was told that just stored one string and when i go to print out …

Member Avatar for jcmoney1010
0
9K
Member Avatar for berwick53

Hi I'm having problems with the code in that everytime it iterates it replaces all the values of SendBack with the newly read in values from fgets! FILE *fp; char FileLoc[] = "123456-12345678.txt"; char *SendBack[10]; fp = fopen(FileLoc, "r"); if (fp != NULL) { int x=0; while (fgets(BUFFER,20,fp)) { SendBack[x] …

Member Avatar for Ancient Dragon
0
135
Member Avatar for goyofoyo

how would one manipulate the code below, using pointers? int add(int a, int b) { int result=0; int s=0, c=0; /* result and carry; carry in for bit 0 is 0 */ /*int bit_a, bit_b; int i, n, mag=0; for(i=0; i<16; i++) { bit_a = ((mask_array[i] & a)?1:0); bit_b = …

Member Avatar for Ancient Dragon
0
97
Member Avatar for gthaliath

Hi I would like to get some directions on where to look for in the way of getting a c++ profram to put hex values on a printer. I would also like to know if some one could guide me with a few examples. Regards GT

Member Avatar for Ancient Dragon
0
35
Member Avatar for dancks

code snippet: void checkcollision() { float x1 = tanks[0].x; float y1 = tanks[0].y; float x2 = tanks[1].x; float y2 = tanks[1].y; float dist = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); float dr = tanks[0].rad+tanks[1].rad; if(dist<dr); { printf("checkcollision read true\n"); printf("dist: %f, radius+radius: %f\n",dist,dr); goback(0); goback(1); } } output: checkcollision read true dist:363.159302, radius+radius:14.142136 …

Member Avatar for dancks
0
119
Member Avatar for sarah.mathieson.7

Hi, I have a counter that I am using in my main and increasing through pointers in other functions. I want to be able to use the value of this counter in a loop but... I can't. I am getting a warning when I compile saying that I am trying …

Member Avatar for deceptikon
0
249
Member Avatar for harishjoy

` LONG APIENTRY Esl_CheckCMTClassRecord(struct CMT_Class_Record *ClassRecord, long *ret) { USHORT uResult; SHORT retcode; uResult = bt3Start(Class.CMT_fd,Class.CMT_data); if(uResult == CLASS_RECORDLENGTH ) { memcpy(Class.CMT_data, ClassRecord , CLASS_RECORDLENGTH); retcode = bt3FindRel(Class.CMT_fd, Class.CMT_data, FR_EQUAL); // Read CMT record if(retcode > 0) // read successful { *ret = 1; return(0); } else { *ret = …

Member Avatar for harishjoy
0
252
Member Avatar for prathiyus

#include<stdio.h> #include<stdlib.h> int main() { int **a,r,c,i,j,; printf("\n enter the size of row"); scanf("%d",&r); printf("\n Enter the size of col"); scanf("%d",&c); //allocating memory a = (int**)malloc (r*sizeof(int*)); for(i = 0;i<r;i++) a[i] = (int*)malloc(c*sizeof(int)); //array elements for(i = 0;i<r;i++) for(j = 0j<c;j++) scanf("%d",&a[i][j]); -------- --------- how to fill the array with …

Member Avatar for Ancient Dragon
0
287
Member Avatar for harishjoy

Hi i am totally new to C and have a doubt on which one is correct below. LIBRARY PWHDENDT InitInstance DESCRIPTION 'PWS Endt Array Functions' ;DATA and CODEare not supported in windows ;DATA PRELOAD MULTIPLE NONSHARED ;CODE PRELOAD SHARED or LIBRARY PWHDENDT ;InitInstance DESCRIPTION 'PWS Endt Array Functions' ;DATA and …

Member Avatar for harishjoy
0
117
Member Avatar for lscamaro

Now, before everyone says anything, I know that goto statements are never needed. Having said that, I was given an assignment to implement them into a sort of some type. I was assigned selection sort and figured that if I wrote the sort without go to's, it would be easier …

Member Avatar for Ancient Dragon
0
141
Member Avatar for dsotelo91

Hi there. I am trying to code a program to add or subtract two polynomials using linked lists. For ex. (+4x^2-2x^1) + (+2x^12-5x^5). So far I have a read function which takes in a string and uses substrings to take the coefficient and exponents and insert it to a node. …

Member Avatar for dsotelo91
0
4K
Member Avatar for dancks

Ok. As the title says I tried many times to simply write a program that rewrites a file to remove null characters. I confirmed with a hex editor that the file in question has tons on null characters, on average about 1 of every 2 characters in null. So my …

Member Avatar for dancks
0
433
Member Avatar for mmeyer49

I am trying to write a smiple email web program. Whenever I try to get an out going email I keep getting the general message that the computer is denying me access. "No connection could be made because the target machine actively refused it " I have tried this at …

Member Avatar for mmeyer49
0
327
Member Avatar for Allahwahid

How we can write a program to get out put given below in c?? 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1

Member Avatar for deceptikon
0
178
Member Avatar for praneeth_gunda

Hi EveryBody,This is the Code I have written for Simplified DES it is delivering the Cipher of 16-bit size actually it should deliver of size 8 Please help me in solving the Problem and even tell me how 2 reduce the Complexity [code] #include<string.h> char ep[8],p10[10],p8[8],ip[8],ip1[8],pr[10],key1[8],key2[8],p4[4]; int s0[4][4]={{1,0,3,2},{3,2,1,0},{0,2,1,3},{3,1,3,2}} ,s1[4][4]={{0,1,2,3},{2,0,1,3},{3,0,1,0},{2,1,0,3}}; void …

Member Avatar for elava
0
502
Member Avatar for RAPTOR88

Hey all. I'm fairly new to programming and I just have a little issue. I have a code that will read in a string of character and outut weather the character are alphabetical or not but i also need to use a counter to count how many time each character …

Member Avatar for Gonbe
0
152
Member Avatar for jdh1231

From the code below, how can I display what elements each processor have? Can someone show me how to do it? I ran it with mpicc -o scatter scatter.c mpirun -np 4 scatter #include <stdio.h> #include <stdlib.h> #include <mpi.h> #define root 0 int main(int argc,char *argv[]) { int rank, p; …

0
68
Member Avatar for pardeep3dec

Dear Experts,can we make dll in turbo c and use that dll in vb 6.0. Actually i have a program in c and it has so many constant 3 dimensional array.I have to use some API which can not be used in turbo c so i am planning to make …

Member Avatar for Schol-R-LEA
0
284
Member Avatar for mahnaz0098

Hello when i use below program to write and read data from USB mass storage device(flash memory) i am getting following error. I've succeeded with usb_bulk_write() but can't utilize usb_bulk_read(). It returns an error. Set configuration usb_bulk_write: 12 bytes written 33 5b 2 1 0 5 1 3 7 f …

0
109
Member Avatar for Carc369

Basically I'm trying to see if the first letter is in the dictionary... then if it is.. check if the first and second letter are in the dictionary.. and if it is... check if the first, second, and third letter are in the dictionary... and so on and so forth. …

Member Avatar for Banfa
0
266
Member Avatar for ali11

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 …

Member Avatar for -[xxxxxxx]-
0
250
Member Avatar for chris.vargas.773

For an assignment for class i wrote this code right but the only problem i have is that i can't get the right value that assignment wants which is distance so far: 0 meters distance so far: 1000 meters distance so far: 0 meters distance so far: 0 meters distance …

Member Avatar for dx9_programmer
0
137
Member Avatar for jake.jackson.7169709

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 …

Member Avatar for dx9_programmer
0
236
Member Avatar for chris.vargas.773

i wrote this code for sending and recieve mail but i can't get the output that is required for class which is -Test 1-- Creating a new envelope Addressing from Muffin To Howie Inserting the message: Pet me! Affix Postage: 0.33 stamp Sealing the envelope Mailing the envelope --Test 2-- …

Member Avatar for dx9_programmer
0
174
Member Avatar for Delnith

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?

Member Avatar for Schol-R-LEA
0
234
Member Avatar for mahnaz0098

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 …

Member Avatar for Ancient Dragon
0
384
Member Avatar for omarelbeik

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. …

Member Avatar for Adak
0
318
Member Avatar for amendonca

Define a function drawRectangle with the following prototype: void drawRectangle(int width, int height, int offest); The function will print a rectangle made out of height rows with '@' character repeated width times on each row. The first @ on each row will be preceded by offset spaces. That means the …

Member Avatar for Ancient Dragon
0
163
Member Avatar for abd2

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 …

Member Avatar for kimchong
2
2K
Member Avatar for kieranrea

**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 …

Member Avatar for somjit{}
0
159
Member Avatar for Ankit.duke

Do any one have idea of implementing the moore machine by c Programming implementation??

Member Avatar for Despairy
0
82
Member Avatar for romiaujla

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 …

Member Avatar for romiaujla
0
216
Member Avatar for luixoja

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. …

Member Avatar for deceptikon
0
131
Member Avatar for jnewman3

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 …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for lp94

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 …

Member Avatar for Adak
0
149
Member Avatar for razorsky

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 …

Member Avatar for j.c.
0
9K
Member Avatar for Learningvinit

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 …

Member Avatar for Learningvinit
0
876
Member Avatar for HunainHafeez

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 …

Member Avatar for HunainHafeez
0
270
Member Avatar for nitin1

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 …

Member Avatar for Adak
0
80
Member Avatar for Delnith

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 …

Member Avatar for Delnith
0
90
Member Avatar for chandan127
Member Avatar for zeroliken
0
768
Member Avatar for shawn.widjaja

good afternoon gents, first semester cs student here. i'm having a world of confusion to create an X having the left formed with "+", the right side formed with "X" and the center with an "*". with an integer of 7, the output should look like: +-----X -+---X- --+-X-- ---^--- …

Member Avatar for deceptikon
0
156
Member Avatar for pooja.singh.3950

want 2 print the following in c using loop |......| |..c...| |..ch..| |..chm..|

Member Avatar for deceptikon
0
230
Member Avatar for pravtdelhi

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 …

Member Avatar for pravtdelhi
0
157
Member Avatar for chandrabhanu

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).

Member Avatar for hahahahohoho
-1
271

The End.