2,384 Posted Topics
Re: This is pretty much the same, but it's all I've got at the moment. [code]#include <stdio.h> char *foo(char *dst, const char *src) { char *start = dst; while ( *src ) { dst += sprintf(dst, "%x", (unsigned)*src++); } return start; } char *bar(char *dst, const char *src) { char *start … | |
Re: Did you [FONT=Courier New]#include <vector>[/FONT]? | |
Re: Cross-posted: [url]http://www.cppworld.com/forum/index.php?showtopic=977[/url] [url]http://forums.devshed.com/t280826/s.html[/url] [edit] [url]http://www.gidforums.com/t-6758.html[/url] [url]http://cboard.cprogramming.com/showthread.php?t=68714[/url] | |
Re: [QUOTE=Ancient Dragon]what is TIFF api? my copy of dev-c++ does not contain tiffio.h[/QUOTE]I'm guessing [url=http://www.remotesensing.org/libtiff/]libTIFF[/url], but I'm not familiar with it. | |
Re: If you write each statement on its own line, you can see that it spells out much of the initial code for you. Make an initial attempt and post that. [QUOTE=mugilan]create a [COLOR=Blue][FONT=Courier New]class[/FONT][/COLOR] called [COLOR=Blue][FONT=Courier New]employee[/FONT][/COLOR] that include three pieces of information as data members [indent] - a [COLOR=Blue][FONT=Courier … | |
Re: It makes me most curious that you use this given the topic of your post. [code]gets(buffer);[/code] | |
Re: >Do the shuffle: shift left shift right shift left OR shift right: I'm too white and can't dance as well: [code]#include <stdio.h> #include <limits.h> #define HEXIT ( CHAR_BIT / 2 ) unsigned char swap_nibble ( unsigned char x ) { return x << HEXIT | x >> HEXIT; } int … | |
Re: [Pointless bumps deleted.] It shouldn't compile because C++ does not allow recursive calls to [FONT=Courier New]main[/FONT]. | |
Re: Paraphrasing code does nothing for me -- show me actual code and I can give actual help. My best guess as to what you are asking would be like this: [code]#include <iostream> #include <fstream> using namespace std; int main() { ifstream file("file.txt"); double value; while ( file >> value ) … | |
Re: [url=http://dev.unicals.com/c89-draft.html#4.9.4.2][font=courier new]rename[/font][/url] | |
Re: Can you post what you've got? [url=http://www.daniweb.com/techtalkforums/announcement8-2.html]We only give homework help to those who show effort[/url] | |
Re: int main(int argc, char **argv) | |
Re: These are just prototypes. [code]void initPlane(char plane[NUMROWS][NUMSEATS]); // POSTCONDITION: // plane[x][0] == 'A', 0<=x<=6 // plane[x][1] == 'B', 0<=x<=6 // plane[x][2] == 'C', 0<=x<=6 // plane[x][3] == 'D', 0<=x<=6 void printPlane(char msg[], char plane[NUMROWS][NUMSEATS]); // POSTCONDITION: The seating layout of the plane has been printed // to the standard output … | |
Re: Thank you for taking the time to post the resolution to your problem. | |
Re: [QUOTE=Jon182]Hey guys, I was just wondering when using classes to obtain a name or something like that when a pointer is used how come you don't have to use the new and delete key words.[/QUOTE]Generally you do. Do you have a more specific example? The one you posted is not … | |
Re: This:[code]int main() [COLOR=Red];float RPar, Rone, Rtwo, Rthree, Rfour, Rfive, Rsix; int quantity; [/COLOR] {[/code]should be like this:[code]int main() { float R[COLOR=Blue]p[/COLOR]ar, Rone, Rtwo, Rthree, Rfour, Rfive, Rsix; int quantity;[/code]Then some more errors that can be fixed by enclosing the statements for the [FONT=Courier New]switch[/FONT] within [FONT=Courier New]{}[/FONT]. And this:[code] case … | |
Re: For my benefit, could you fix this part: [code] typedef struct dataNode { char arriveCity[30]; char departCity[30]; int totalPassengers; int passengers; int flightNumber; struct dataNode * left; struct dataNode * right; };[/code]The name of the typedef is between the [FONT=Courier New]}[/FONT] and the [FONT=Courier New];[/FONT] - that empty part. I've … | |
Re: [thread=23139]It's been discussed[/thread]. [opinion=mine] I still don't think we've hit the critical mass here, so I still think it's an extra burden for regulars and mods for now (to point out the differences, or inguire about which language is being used). For example, if there's 20 questions in the [I]C … | |
Re: C++? Homework? [FONT=Courier New][url=http://www.dinkumware.com/htm_cpl/algorith.html#unique]uinque[/url][/FONT]/[FONT=Courier New][url=http://www.dinkumware.com/htm_cpl/algorith.html#unique_copy]uinque_copy[/url][/FONT]? | |
Re: Say, that code looks quite [url=http://cboard.cprogramming.com/showthread.php?p=326322#post326322]familiar[/url]. How much have you tried doing yourself? [edit][url=http://www.gidforums.com/showthread.php?p=29934#post29934]Cross-posted[/url]. | |
Re: [QUOTE=swchee]1. Is the graphic header file come together as standard library?[/QUOTE]No. Maybe 20 years ago it was "common" with Borland's compiler for DOS. If you're not planning to program in DOS for the future, look to more modern alternatives. Unfortunately, I'm not you best resource. [QUOTE=swchee]2. is the function setColor(), … | |
Re: [QUOTE=Drowzee]However, when I start the program, packfile defaults to 0xcdcdcdcd.[/QUOTE]Isn't that a Microsoft-specific debug-only kinda thingy? Does this happen when you explicitly set the pointer to NULL in the constructor? [edit]I didn't read all of [url=http://www.microsoft.com/msj/1198/c/c1198.aspx]this[/url], but it looks like it discusses the [FONT=Courier New]0xcdcdcdcd[/FONT] value. | |
Re: How about starting a new thread and posting a bit of sample code and usage? My mindreading abilities are diminished lately. | |
Re: [QUOTE=cyber_aziz]you can clear a string like this char ch; char ch = {' '}[/QUOTE]Here since [FONT=Courier New]ch[/FONT] is a single character it cannot be a string.[QUOTE=cyber_aziz]you can clear a string like this char ch; ch[] = {' '};[/QUOTE]And this is even worse. You cannot assign to arrays. You need a … | |
Re: [QUOTE=indianscorpion2]he would be comfortable with 10 or atmost 20 elements.[/QUOTE]This is the attitude of someone who wants to write code that will break. You are being advised -- in a very simple way -- how to help make your code unbreakable. Why the hostility? Eventually, "you'll never need more that … | |
Re: You can "clear" a C-style string by writing a null byte to the first character:[code]strg[0] = '\0';[/code] | |
Re: [QUOTE=server_crash]1) Why is it possible different data types(which should be different sizes) be the same size in memory? Take the sizeOf() function. I read where it's possible that you can pass it a long and print out the result, pass it a integer and print out the result, and you … | |
Re: [QUOTE=wu7jian]printf("%c was appended to arr\n",*(char*)p); header <stdio.h> i met a lot of this kind of situation.what are these "%d,%c"stand for? is there a detailed list about this?[/QUOTE]Your compiler's documentation will tell you all about the implementation of the standard library functions. | |
Re: [QUOTE=webempress]Can anyone help me convert char to double. Yes, I tried casting, it did not work.[/QUOTE]While you're learning to program don't splash casts all over the place to disguise your own errors. [url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.1[/url] | |
Re: [code] printf("The numbers are %d and %d."[COLOR=Magenta],[/COLOR][COLOR=Blue]a[/COLOR],[COLOR=Blue]b[/COLOR]);[/code] | |
Re: [FONT=Courier New]%E expects a [FONT=Courier New]double[/FONT], [FONT=Courier New]rand()%10+20[/FONT] is an [FONT=Courier New]int[/FONT].[/FONT] | |
Re: [url=http://en.wikipedia.org/wiki/Idempotent_%28software%29]Idempotence[/url] | |
Re: [QUOTE=rks01]but im getting an error code " E2294 structure required on left side of . or .* in function main() "[code]int main() { Account account1(); [/code]any help is muchly appriciated.[/QUOTE][url]http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.2[/url] | |
Re: >generates a whole slew of errors. What's your compiler? What are the errors? (As in, please post them.) | |
Re: Post what you've tried. You may want separate threads for each problem. For #1: do you know how to do the calculations? For #2: how are you planning on storing the big numbers? | |
Re: How to slow potential responses...[QUOTE=jhdobbins]Here is a chunk of my program... without the class and header file...[/QUOTE]Lacking enough information to keep me from being able to compile it and benefit from the compiler's diagnostic messages. Do you intend for this to be a comparison rather than an assignment? [code]if (point … | |
Re: The usual way is to read and rewrite. [url]http://www.eskimo.com/~scs/C-faq/q19.14.html[/url] Seeking on files opened in text mode may be precarious. | |
Re: Various pieces have been presented and discussed already. Here's how I might piece some things together. [code]#include <stdio.h> char *getline(char *dst, size_t size) { size_t i = 0; for ( ;; ) { int ch = getchar(); if ( ch == '\n' || ch == EOF ) { break; } … | |
Re: [QUOTE=kartik911]My question is : How do you create a program which will take a filename as an argument, check whether the file is present and open it (if the file is not present create that file).[/QUOTE]Use the form:[code]int main(int argc, char *argv[])[/code]Check for [FONT=Courier New]argc[/FONT] being greater that 1. Try … | |
Re: Don't know, but found this. [quote][url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcerrLinkerToolsErrorLNK2019.asp][B]Linker Tools Error LNK2019[/B][/url] [...] This error can also be generated as a result of conformance work that was done for Visual Studio .NET 2003: template friends and specialization. In Visual Studio .NET 2003, a friend declaration that declares a new non-template function must be … | |
Re: And for those who weren't aware of the cross-posting, there's this: [url]http://www.gidforums.com/t-6485.html[/url] Where else this may be I don't know. But it is always nice for the OP to tell others that the question may already be answered elsewhere. | |
Re: [QUOTE=murschech]Does anyone have any insights to offer?[/QUOTE]I'll try. [QUOTE=murschech]Here's an example that doesn't work. The variable 'a' in file 1 is external (since it's defined outside of any function) so, according to the above paragraph, it should have the same value in file 2. The program, however, doesn't compile.[/QUOTE]As it … | |
Re: [QUOTE=mozira]I see Dave Sinkula understands C++ very well.[/QUOTE]Not as well as many others.[QUOTE=mozira]How can one be assisted by Dave Sinkula[/QUOTE]Ask questions that I can answer. Hopefully the ones I can't answer will be answered by someone else. | |
Re: >What is that called? An [url=http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.6]initialization list[/url]. | |
Re: cin stops at whitespace -- use getline for input with spaces. | |
Re: >Any suggestions? Post your simple example code. Post the command line used to attempt to compile it. Post the error messages you receive. | |
Re: [QUOTE=brycegordon]Does this link in with actually making a nice program the has buttons and stuff that you can actually use? Like a windows application?[/QUOTE]Probably not. Any decent book about the C or C++ language shouldn't. Graphics and other API stuff for use with the core language should probably be learned … |
The End.