1,265 Posted Topics
Re: 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 = … | |
Re: 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. | |
Re: 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 … | |
Re: 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] | |
| |
Re: 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()" | |
Re: [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 … | |
Re: 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 … | |
Re: 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. | |
Re: [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 … | |
Re: 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 … | |
Re: there once was a man from Nantucket | |
Re: yeah, um, i think I'm gonna have to ask you to come in again this Saturday. | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: [quote]will/may pay cash.[/quote] lol he wont get far on a job offers site with that verbiage. | |
Re: 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 … | |
Re: 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 … | |
Re: never mind. i dunno. too late to start | |
Re: [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 … | |
Re: why would you want to use a hammer when you need a screwdriver? | |
Re: 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. | |
Re: 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, … | |
Re: what kind of outfit do you think this is? do you see a PayPal button somewhere that I missed? . | |
Re: 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 … | |
Re: 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 … | |
Re: 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); // … | |
Re: 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 … | |
Re: 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 … | |
Re: why are you trying to make your makefile? the command should just be "make"... should it not? | |
Re: 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 … | |
Re: it appears you're trying to close a file pointer before it has been opened. | |
Re: 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] | |
Re: 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?? . | |
Re: 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 … | |
Re: 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 … | |
Re: what did this have to do with C? | |
Re: 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 … | |
Re: 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 … | |
Re: [url]http://www.digitalmars.com/[/url] you have my sympathy. |
The End.