1,265 Posted Topics

Member Avatar for larryeis

dragon's is a very nice and concise example of how to pass a float to a function. here's how you could fix your code to work as it is. [code=c] int object1 = 100 ; int object2 = 1000; float object_f1 = (float)object1; float object_f2 = (float)object2; float *ptr_object1 = …

Member Avatar for Prabakar
0
94
Member Avatar for arunkp

if you're using winXP, you should NOT be using some old crusty DOS compiler MSVC is given away free by Microsoft. get it. use it. love it.

Member Avatar for jephthah
0
215
Member Avatar for rob_xx17

your STATE variable (it seems) is an array of integers, correct? fputs expects a pointer to a character string, and you're using fprintf wrong. look up the definition of predefined functions in any code reference, when they dont behave like you think they should [url]http://www.cplusplus.com/reference/clibrary/cstdio/fprintf.html[/url] not knowing anything about your …

Member Avatar for jephthah
0
2K
Member Avatar for oceanaut
Member Avatar for web_master

for linux, see: [url]http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/[/url] for Windows, see: [url]http://en.wikipedia.org/wiki/Conio.h[/url]

Member Avatar for jephthah
0
3K
Member Avatar for wsn
Member Avatar for jephthah
0
104
Member Avatar for Afi83

question: does each line of your data always have the same number of INTs and FLOATs, and are they always found in the same order? if so, Dragon's suggestion for "sscanf()" is perfect. if not, you will need a more complex routine, perhaps using "strtok()"

Member Avatar for Afi83
0
437
Member Avatar for w0090463

[quote]I am asking for a program which is return in C language[/quote] I'm the giver and you're the receiver. copy it directly into your assignment and hand it in. then come back and tell me how high your grade was. i'm certain you will get an "A" [code=c]#include <stdio.h> #include …

Member Avatar for ajay_kumar47
0
174
Member Avatar for squint

this is a common "problem" with floating point numbers: most floating point representations of decimal values are not exact numbers.. they are approximations. [b]here's the short answer[/b]: single-precision floating point value (type float) is represented by 24 bits in the mantissa, and 8 bits in the exponent. this is in …

Member Avatar for jephthah
0
116
Member Avatar for sonia sardana

sounds like those stupid interview questions hipsters at places like Microsoft think its cool to ask ... anyhow, my first thought was temperature. but i like the height of the sun better.

Member Avatar for Salem
0
83
Member Avatar for wollacott

[quote] i need to declare it outside[/quote] so pick up your laptop and go declare it outside. just make sure it's not raining, or that you have a good awning at least. sorry. :P actually i dont understand your question. what are you trying to declare "outside" ? and why …

Member Avatar for Narue
0
182
Member Avatar for knewc

yeah, because as we all know, Napoleon loved to make puns in English. ... and hey challenging dude. apologies that we're not all just peeing our pants with delight over the prospect of taking your "challenge" now here's a challenge for [b]YOU[/b]. Locate the "search" button on this site. your …

Member Avatar for ithelp
0
162
Member Avatar for Ryano24
Member Avatar for guvengunes
Member Avatar for jephthah
-4
97
Member Avatar for rock_rocks
Member Avatar for fredmac

i think this is the guy who insisted C++ code was C. so it just makes sense that he puts his assembly code here as well.

Member Avatar for jephthah
-1
86
Member Avatar for cbrown153

you could, of course, just use the format modifiers that go with printf() ex. [inlinecode]printf("%20s",myText);[/inlinecode] prints the char string "myText" in a 20-character wide field, left justified, padding unused characters with whitespace. while [inlinecode]printf("%-20s",myText);[/inlinecode] does the same thing except the text is right-justified. you are responsible for ensuring that the …

Member Avatar for Aia
0
69
Member Avatar for rayscosmic

easiest way is to (1) do a dir (ls) listing of directory contents, parse each one for a .c extention. start with the first .c file... (2) open the .c file for READ, to a file handle. (3) open a new .c file to WRITE to a different file handle …

Member Avatar for KevinADC
0
160
Member Avatar for tah

Hello Tah. please excuse Narue's brusqueness. her chainsaw needs oiling. Now I have made for you a handy program to use in situations just like the one that you are looking for: [code=c]#include <stdio.h> int main () { printf("hello world!\n"); return 0; }[/code] please feel free to cut and paste …

Member Avatar for jephthah
0
261
Member Avatar for knight fyre

welp, i just tried to compile your C code, and got a flood of compiler errors. god forbid anyone try and run your code on a non-Windows environment. for this reason you should stay away from CONIO.H and DOS.H... but i imagine your entire class uses nothing but windows, and …

Member Avatar for jephthah
0
122
Member Avatar for fredmac

SALEM, he's actually getting better. his first 2 posts were "do this for me" without any code whatsoever. now at least he's putting up some code. FREDMAC: what, exactly, do you expect this block of code to do? [code] printf(" Enter 5 to run the program or 6 to exit …

Member Avatar for jephthah
0
202
Member Avatar for Sh13

another thing, "miles" needs to be initialized to zero before you start iteratively adding values into it. just declaring it as a float does not initialize it.

Member Avatar for Sh13
0
119
Member Avatar for Cbeginner_us
Member Avatar for Sh13

fscanf is problematic. you can easily shoot yourself in the foot with it. if the file is not EXACTLY as you think it is supposed to be it will write garbage. it's very easy to use scanf wrong. consider using fgets() instead of fscanf(). then you can choose from a …

Member Avatar for jephthah
0
94
Member Avatar for bballa99

[quote]will/may pay cash.[/quote] lol he wont get far on a job offers site with that verbiage.

Member Avatar for jephthah
0
84
Member Avatar for marquis1431

if you dont need to recall every individual grade, you can just add each grade for that person to a running total, and keep track of the number of entries. then just divide the total by the number of entries for the average. if you need to retain each grade …

Member Avatar for jephthah
0
95
Member Avatar for digiman

you cant keep using strtok like that the first use of strtok must call out the buffer as you did: [inlinecode]my_ptr = strtok(buf,",");[/inlinecode] but each subsequent use of strtok on this file handle must use NULL instead of the buffer name. the buffer name is kept track internally. recalling it …

Member Avatar for Ancient Dragon
0
143
Member Avatar for programmer321
Member Avatar for LadyPersia

[QUOTE]First I have a question: Is there a mistake? Maybe an even number adds up to 3 primes summed up or even more?[/QUOTE] a mistake where? in Goldbach's Conjecture? if you've found a mistake there, get ready for publication in the journals. an even number can only be the sum …

Member Avatar for jephthah
0
972
Member Avatar for Spaiz
Member Avatar for jephthah
0
58
Member Avatar for TheSmokey777

i always hated it when i realized 3/4ths of the way through a semester i'd been sitting in the wrong class. it did sort of make sense, in hindsight, as to why i thought everyone was talking moon-man talk.

Member Avatar for jephthah
0
105
Member Avatar for fredmac

okay... cut and paste this program: [url]http://www.engin.umd.umich.edu/CIS/course.des/cis400/c/hworld.html[/url] then, add a couple lines: divide is done with the '/' operator and remainder (modulus) is done with the '%' operator. another option (and one that may save you a lot of time) is to drop the class now, eat the GPA hit, …

Member Avatar for jephthah
0
107
Member Avatar for fredmac

what kind of outfit do you think this is? do you see a PayPal button somewhere that I missed? .

Member Avatar for jephthah
0
349
Member Avatar for shadow_shooter
Member Avatar for Gerritt

Dear Gerrit, I just looked at the link posted by Chandrashekhar1.... let me save you some time. What he posted is pure crap. It's largely incomprehensible, and likely rife with errors. don't waste your time downloading it. go instead to any one of a number of credible and freely available …

Member Avatar for jephthah
0
113
Member Avatar for missileh

definitely. stay away from any site that wants you to pay for "lectures" on something as universal as C programming you can find tons of high quality and freely available tutorials and lectures from credible institutions and individuals all over the internet, without resorting to some dubious "institute of computer …

Member Avatar for jephthah
0
143
Member Avatar for nelledawg

make your "firstUpper( )" function look like this. this is basically what Ancient Dragon suggested from the previous thread. [code=c] void firstUpper(char *buf) { while (*buf) // continue as long as characters avail { while(*buf == ' ') *buf++; // skip all spaces until next char *buf = toupper(*buf); // …

Member Avatar for jephthah
0
115
Member Avatar for pralu

in general terms (although not exactly precise), the "socket descriptor" is used like the "handle" for the socket, similar to a FILE * handle. [inlinecode]int sd = socket(AF_INET, SOCK_STREAM, 0); [/inlinecode] where "sd" is the socket descriptor and, like a file handle, is then used to make additional calls to …

Member Avatar for jephthah
0
410
Member Avatar for soosai

i sure wish you'd use CODE tags, when you post code, please. it will help me to help you if i can *read* your code. anyhow... check your line: `for(i=0,row=0;i<48;i++,row=row+10);` it has a semicolon after it. so `MPI_Send(&oldrow,s,MPI_INT,i,246,MPI_COMM_WORLD);` is only executed once. there may be other problems, i dunno. but …

Member Avatar for Salem
0
157
Member Avatar for wsn

why are you trying to make your makefile? the command should just be "make"... should it not?

Member Avatar for wsn
0
129
Member Avatar for dipps

you have an interrupt service routine of some sort. when you get an interrupt, process the row that had the keypress event by calling the row function according to the particular interrupt. or call all four row functions in sequence if the interrupt is just generic to the keyboard and …

Member Avatar for dipps
0
129
Member Avatar for programmer321
Member Avatar for programmer321
0
2K
Member Avatar for cd0712

here's your start: [code=c] int main (int argc, char *argv[]) { if (argc != 2) // { printf("usage: %s <filename>\n",argv[0]); return 1; } else printf("your filename is <%s> ...\n",argv[1]); return 0; } [/code]

Member Avatar for jephthah
0
140
Member Avatar for wollacott

you STILL are trying to define "fgets". fgets() is a standard library function, you do not need a prototype. that you're trying to do so, is at least part of your problem. and do you REALLY want a character array ("buffer") to be 5 Megabytes in size?? .

Member Avatar for jephthah
0
288
Member Avatar for wollacott

your "ReverseLetters" function doesnt work. You had some other problems as well. ive outlined one way you can approach this. now you need to (1) fix the "reverseLetters" function, then (2) write the palindrome detector. [code=c]#include<stdio.h> #include<string.h> void swap(int i, int j) { int t; t=i; i=j; j=t; } int …

Member Avatar for jephthah
0
148
Member Avatar for kpnprakash

here, try this... just remove the comments, change some variable names, sign it and turn it in. trust me, it works. you'll get an "A" for sure. [code=c] /* diff - compare files line by line Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 2001, 2002, 2004 Free Software …

Member Avatar for Ancient Dragon
0
132
Member Avatar for Majestics
Member Avatar for rohit83.ken

sounds like you dont have the libraries installed. probably want to use your package manager (yum, pup, whatever) to get it.. you can get it straight from Subversion, if you dont mind trusting their malformed ssl certificate [url]https://svn.netfilter.org/netfilter/trunk/iptables/libipq/[/url] you probably also need the <socket.h> header. this should be standard with …

Member Avatar for jephthah
0
576
Member Avatar for Indianblues

step (1): connect to database step (2): query database, according to your database API step (3): read results returned from query step (4): close database connection. i don't know much about Oracle, but the MySQL API is here : [url]http://dev.mysql.com/doc/refman/5.0/en/c.html[/url] for MySQL, you will include the <mysql.h> and link to …

Member Avatar for jephthah
0
87
Member Avatar for Ints
Member Avatar for jephthah
0
133

The End.