2,384 Posted Topics

Member Avatar for Sutanu

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 …

Member Avatar for Sutanu
0
2K
Member Avatar for Drowzee
Member Avatar for Clint1982
Member Avatar for jwenting
0
66
Member Avatar for kokopo2

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]

Member Avatar for Dave Sinkula
0
455
Member Avatar for thiru.y

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

Member Avatar for Ancient Dragon
0
615
Member Avatar for mugilan

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 …

Member Avatar for nattylife
0
1K
Member Avatar for Daishi

It makes me most curious that you use this given the topic of your post. [code]gets(buffer);[/code]

Member Avatar for Daishi
0
234
Member Avatar for nanosani

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

Member Avatar for Daishi
0
317
Member Avatar for 3265002918

[Pointless bumps deleted.] It shouldn't compile because C++ does not allow recursive calls to [FONT=Courier New]main[/FONT].

Member Avatar for 3265002918
0
345
Member Avatar for Analogsleeper

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

Member Avatar for Dave Sinkula
0
243
Member Avatar for bops

[url=http://dev.unicals.com/c89-draft.html#4.9.4.2][font=courier new]rename[/font][/url]

Member Avatar for bops
0
291
Member Avatar for gabe522k3

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]

Member Avatar for gabe522k3
0
118
Member Avatar for indianscorpion2
Member Avatar for konacious

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 …

Member Avatar for konacious
0
214
Member Avatar for DotNetUser
Member Avatar for Dave Sinkula
0
1K
Member Avatar for Mike182
Member Avatar for Jon182

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

Member Avatar for Dante Shamest
0
118
Member Avatar for bandm

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 …

Member Avatar for Dave Sinkula
0
324
Member Avatar for jhdobbins

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 …

Member Avatar for jhdobbins
0
130
Member Avatar for indianscorpion2

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

Member Avatar for jhdobbins
0
311
Member Avatar for khan_069

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]?

Member Avatar for Lerner
0
122
Member Avatar for NolanVW

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

Member Avatar for NolanVW
0
1K
Member Avatar for swchee

[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(), …

Member Avatar for Dave Sinkula
0
114
Member Avatar for Drowzee

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

Member Avatar for Stoned_coder
0
310
Member Avatar for JoBe

How about starting a new thread and posting a bit of sample code and usage? My mindreading abilities are diminished lately.

Member Avatar for Dave Sinkula
0
448
Member Avatar for cjones5499

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

Member Avatar for Dave Sinkula
0
572
Member Avatar for umbrella

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

Member Avatar for Dave Sinkula
0
442
Member Avatar for Judas

You can "clear" a C-style string by writing a null byte to the first character:[code]strg[0] = '\0';[/code]

Member Avatar for Dave Sinkula
0
1K
Member Avatar for server_crash

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

Member Avatar for server_crash
0
163
Member Avatar for wu7jian

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

Member Avatar for Dave Sinkula
0
141
Member Avatar for webempress

[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]

Member Avatar for Dave Sinkula
0
365
Member Avatar for eivnay

[code] printf("The numbers are %d and %d."[COLOR=Magenta],[/COLOR][COLOR=Blue]a[/COLOR],[COLOR=Blue]b[/COLOR]);[/code]

Member Avatar for Acidburn
0
157
Member Avatar for altheastronut

[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]

Member Avatar for altheastronut
0
280
Member Avatar for Jon182

[url=http://en.wikipedia.org/wiki/Idempotent_%28software%29]Idempotence[/url]

Member Avatar for winbatch
0
148
Member Avatar for wu7jian
Member Avatar for rks01

[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]

Member Avatar for rks01
0
195
Member Avatar for 3265002918

>generates a whole slew of errors. What's your compiler? What are the errors? (As in, please post them.)

Member Avatar for 3265002918
0
794
Member Avatar for POW

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?

Member Avatar for Dave Sinkula
0
77
Member Avatar for jhdobbins

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 …

Member Avatar for jhdobbins
0
201
Member Avatar for Analogsleeper

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.

Member Avatar for Dave Sinkula
0
150
Member Avatar for zeek

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; } …

Member Avatar for Narue
0
452
Member Avatar for kartik911

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

Member Avatar for Narue
0
276
Member Avatar for winbatch

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 …

Member Avatar for winbatch
0
313
Member Avatar for karen_CSE

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.

Member Avatar for karen_CSE
0
1K
Member Avatar for murschech

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

Member Avatar for Dave Sinkula
0
147
Member Avatar for mozira

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

Member Avatar for Dave Sinkula
0
363
Member Avatar for kharri5

>What is that called? An [url=http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.6]initialization list[/url].

Member Avatar for Drowzee
0
778
Member Avatar for karen_CSE
Member Avatar for karen_CSE
0
1K
Member Avatar for 1337WTF

>Any suggestions? Post your simple example code. Post the command line used to attempt to compile it. Post the error messages you receive.

Member Avatar for Dave Sinkula
0
130
Member Avatar for brycegordon

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

Member Avatar for vegaseat
0
387

The End.