6,741 Posted Topics

Member Avatar for The Dude

>This is a petition against the live skinning of cats,dogs and other animals in China. Save the animals! But only if they're cute...and domesticated...and not delicious. >Please be aware if you click on the video it is VERY >GRAPHIC - the most disturbing,graphic video ever If it's presented by the …

Member Avatar for >shadow<
1
281
Member Avatar for cheesy_mel

Why use fread at all? fgets seems to be a better fit for your problem, especially since you're using it [i]anyway[/i] to preprocess the record lengths. The more input requests you make, the slower your code will be, so if optimization in your goal, minimize the number of calls that …

Member Avatar for cheesy_mel
0
123
Member Avatar for Seamus McCarthy

>I'm betting I'll spot the problem in 3.2 nanoseconds. If it's what I think it is, what makes you think spotting the problem will take that long? ;)

Member Avatar for Seamus McCarthy
0
99
Member Avatar for wleemitch

>; Index < PlayerName.size() That doesn't make sense at all. You're using the length of the name entered to specify how many names are in the vector? Try [ICODE]Names.size()[/ICODE] instead of [ICODE]PlayerName.size()[/ICODE]. >if ( PlayerName == Names[Index] ) Currently this fails because Index specifies an element that doesn't exist. Your …

Member Avatar for wleemitch
0
97
Member Avatar for scream2ice

Wow, um, I'd probably better give you a better example first: [code=cplusplus] #include <string.h> #include <iostream.h> int main() { char line[100]; while ( cin.getline ( line, sizeof line ) ) { char *p = strstr ( line, ".zip" ); if ( p != 0 ) strcpy ( p, ".rar" ); …

Member Avatar for scream2ice
0
155
Member Avatar for whoknows101

C++ is case sensitive, and standard names tend to be all lower case.

Member Avatar for whoknows101
0
304
Member Avatar for Aamit

You couldn't even wait a full minute before bumping your thread? :-O Have you tried reading the [url=http://msdn2.microsoft.com/en-us/library/ms724880(VS.85).aspx]reference material[/url] before begging for help?

Member Avatar for Narue
0
96
Member Avatar for sanu_sharma
Member Avatar for Narue
0
24
Member Avatar for Waseemn

>NOT USING ARRAYS If you can't use arrays because they haven't been covered, you can't use any of the alternatives, because they're more advanced. Your program is likely impossible with the given restrictions, sorry.

Member Avatar for ithelp
0
101
Member Avatar for echoestroy

>this should work. Please specify what changes you made, and ideally why you made them.

Member Avatar for echoestroy
0
104
Member Avatar for Run.[it]

If I understand your question correctly, you want to return a reference to one of the structure instances inside your object: [code=cplusplus] #include <iostream> struct block { int data; }; class block_collection { static const int _size = 10; block _base[_size]; public: int get_size() const { return _size; } block& …

Member Avatar for Run.[it]
0
130
Member Avatar for Waseemn

>Is there a toProper() in C++? No, you have to write it yourself. However, it's not terribly difficult to do: [code=cplusplus] #include <cctype> #include <iostream> #include <string> bool isWordChar ( char c ) { const std::string word_chars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; return word_chars.find ( c ) != std::string::npos; } std::string toProper …

Member Avatar for Narue
0
89
Member Avatar for KK Murage
Member Avatar for Narue
0
153
Member Avatar for sfurlow2
Re: I/O

For simplicity sake: [code=cplusplus] #include <fstream> #include <iostream> #include <string> int main() { std::ifstream in ( "myfile" ); if ( in ) { std::string word; while ( in>> word ) std::cout<< word <<'\n'; } } [/code]

Member Avatar for Narue
0
86
Member Avatar for dgg32

>No idea why my program keeps crashing. I'd start here: [code=cplusplus] strncpy(word,p1,len); [/code] And I'd start by recognizing that word doesn't point to anywhere meaningful yet. You're trying to write to an uninitialized pointer.

Member Avatar for Aia
0
372
Member Avatar for pete212

The main function has two parameters: argc and argv. The names are irrelevant, as you can change them to be whatever you want, but argc and argv are the most common. argc means [B]arg[/B]ument [B]c[/B]ount, and it's an integer value specifying how many arguments were received. argv means [B]arg[/B]ument [B]v[/B]ector, …

Member Avatar for Narue
0
218
Member Avatar for TuX4020

>Does anything that I've put jump out as an error I've made? Yes, I see one problem if the vector doesn't already have a size equal to or greater than the size of the array: copy doesn't call push_back, it performs a direct assignment. I'd do something more like this: …

Member Avatar for TuX4020
0
3K
Member Avatar for scapu

>Mabey this function I made will help you You're allowed to use whitespace, you know. That code is pretty nasty with the current formatting.

Member Avatar for William Hemsworth
0
101
Member Avatar for Jboy05

>I have no idea on how the do Not a clue? Can't even form a thought? Seriously, are you so incompetent as to be completely unable to come up with [i]anything[/i]? It doesn't have to be a complete solution, you know. Programmers tend to work incrementally, solving small problems first …

Member Avatar for Nick Evan
0
228
Member Avatar for savinki

'D' isn't likely to have the value 13. You need to convert the character to a hexadecimal digit value: [code=cplusplus] #include <cctype> // Return [0,15] on success, -1 on failure int hex_value ( unsigned char c ) { if ( std::isxdigit ( c ) ) { // Assume 'A' - …

Member Avatar for Narue
0
88
Member Avatar for wollacott

>which doesnt work as a c program its c++ There's nothing wrong with the loop in C99. If you're getting an error about declaring i in the initialization clause, it's likely that you're compiling as C89 rather than C99. In that case you change your loop to this: [code=c] int …

Member Avatar for Narue
0
182
Member Avatar for Black Magic

>just wondering if there was a way i could make it shorter? Yes, there are plenty of ways. Will they be an improvement? Probably not. The single best way to make your code shorter is to remove redundancy, but at the small length of your program, it's hard to remove …

Member Avatar for Black Magic
0
142
Member Avatar for doddware

>have relied on Visual Studio C++ 6.0 I'm sorry. I once relied on Visual Studio 6.0 too, and I'm thankful that there are better versions now. >but then the code fails to build!! What a shocker. Speaking of compatibility, did you know that my old installation of Visual Studio 6.0 …

Member Avatar for doddware
0
134
Member Avatar for Google Spider

>I would like to hear an explanation on why I can't do this. Because you never told p where to point. Thus, it could point anywhere, and "anywhere" is very likely outside of your address space.

Member Avatar for Google Spider
0
136
Member Avatar for Black Magic

>Should i use srand() or something? You answered your own question. Yes, you should use srand if you want the sequence to start with a different number each time. Otherwise it always gets seeded to 1, and on your compiler (Visual C++, I'm guessing) the first number generated with a …

Member Avatar for Narue
0
138
Member Avatar for kv79

>Why did you refuse to accept this like a man above you ?... Because a woman with female reproductive organs and a male "identity" is still physically a woman. How is that difficult to understand? [quote=Article] "I opted not to do anything with my reproductive organs because I wanted to …

Member Avatar for steven woodman
0
143
Member Avatar for santoo

>it is just writing into log entry Is it also writing the ProcessMessage log entries? It looks to me like you'll never get inside the outer if statement in ProcessMessage because you never set _IsStarted to true, and the default value is false.

Member Avatar for santoo
0
142
Member Avatar for stan.joe1

Please tell us what kind of problem you need help with. We can't offer anything more than general advice if you don't specify what's wrong with your code.

Member Avatar for dmanw100
0
326
Member Avatar for Aia

Use spaces instead of tabs, and this problem will pretty much go away. I know that's not a "real" solution, but it's a workaround until Dani admits that there's a problem. ;)

Member Avatar for Aia
0
169
Member Avatar for CE Student

>I do not have any time it is only 2 hours I guess you're learning the lesson of getting your work done on time because nobody is interested in doing it for you.

Member Avatar for Narue
0
136
Member Avatar for fusi0n423
Member Avatar for fusi0n423
0
124
Member Avatar for Skeezo

The function definition must match the declaration exactly. That means order of parameters as well as type.

Member Avatar for Skeezo
0
426
Member Avatar for WolfPack

Perhaps have an option to set the tab stop explicitly in the code tags: (code=c, tab=2) #include <stdio.h> int main ( void ) { puts ( "Hello, world!" ); return 0; } (/code)

Member Avatar for Dani
0
319
Member Avatar for tah

Hi, do it your damn self. We're not a homework service, but if you actually make an attempt, we'll be happy to help you along a little bit.

Member Avatar for jephthah
0
261
Member Avatar for tigger0484

>when I run it I get a bunch of garbage... I'm not surprised. You assume specific sizes and neglect to take the null character into account when copying. Run your code in a debugger, watch how concat and copy move characters around. You'll quickly see the problem, I'm sure.

Member Avatar for tigger0484
0
264
Member Avatar for ericisshort

A segmentation fault is when you access memory that doesn't belong to you. Usually it results from dereferencing a pointer that doesn't point where you expect, or indexing an array out of bounds.

Member Avatar for mitrmkar
0
103
Member Avatar for wiggles

>i just dont know what to do about the computer player Start by working out exact steps for how you determine the best move. Codifying those steps puts you a long way toward writing an AI for your game. >What is the best way to end a program Returning from …

Member Avatar for Narue
0
2K
Member Avatar for swaret

>if, in your opinion, the destructor i wrote is correct It looks fine to me. >if i need a copy constructor in this program Yes, unless you're okay with two objects aliasing the same tree. Your two options are writing a full copy constructor that clones the tree, or disallowing …

Member Avatar for swaret
0
129
Member Avatar for octavia

UINT is an unsigned (meaning it doesn't hold negative values) integer (meaning it only holds whole numbers) type. The usage is basically the same as "unsigned int".

Member Avatar for Narue
0
329
Member Avatar for buvnut

>could any1 tell me how to implement this? Use this hash function until you get the rest of your hash table working: [code=cplusplus] unsigned hash ( int ) { return 0; } [/code]

Member Avatar for Narue
0
110
Member Avatar for daviddoria

>why is this? Dumb luck. You happened to write to memory that isn't critical to the operation of the program. Therefore, it doesn't crash immediately, only silently corrupts whatever was there. Whether it seems to work or not, you're always taking a huge risk by overflowing your memory.

Member Avatar for Narue
0
114
Member Avatar for sohamghosh

>is it also possible to define 2D arrays? Yes. >how do I pass them into the functions Just like passing any other type, you match the declaration: [code=cplusplus] void foo ( int a[2][5] ); int main() { int a[2][5]; foo ( a ); } [/code] There are variations, of course, …

Member Avatar for Narue
0
78
Member Avatar for The Dude

>10. Always wear a belt >2. Do NOT tuck in your shirt (unless at a formal event or when layering) Hmm, always wear a belt but don't tuck in your shirt? Wouldn't that hide the belt for most shirts and negate rule #10? >9. White socks are only worn during …

Member Avatar for jbennet
0
71
Member Avatar for steven woodman

I got one a couple of years ago for, wait for it, Keep It Pleasant. :icon_rolleyes: I was [url=http://www.daniweb.com/forums/post256575.html#post256575]enlightening[/url] a noob on the merits of honesty, and I'm still not sorry. >I just realized Im probably the only person whos gotten an infraction. Ha! If you only knew. We probably …

Member Avatar for jbennet
0
237
Member Avatar for ICER1

Sorry dude, I haven't worked with 3DS Max for about three major versions. Even then I didn't do much animation. You're better off asking on a forum that specializes in 3D art; Daniweb doesn't really touch on that particular field, so your question is likely to go unanswered. Have you …

Member Avatar for ICER1
0
129
Member Avatar for RyanLeaf

>My initial question is whether or not should I start with C++ or Assembly? Given only those two options, you'd probably get more out of C++ and have an easier time picking up many of the concepts of modern programming. >I know I probably will end up using Assembly I …

Member Avatar for Ancient Dragon
-1
500
Member Avatar for sopel39

>suppose user put const Class as typename T. Then you should respect their wishes, duh. A smart pointer doesn't sound very smart if it doesn't know how to properly point to a const type...

Member Avatar for Narue
0
96
Member Avatar for knightblaze1182

It's simple, the friend declarations don't match your function declarations. However, you're hiding that particular error by assuming that using the class' version of T automagically makes the friend declarations template functions. It doesn't, you have to specify that yourself. For example: [code=cplusplus] friend void insertSorted(Node<T> *x, T d); [/code] …

Member Avatar for Narue
0
80
Member Avatar for Vic842

What language you use depends on your preferences and the needs of your software. I'd say start with a general purpose language and specialize as you learn more about what you want to do. A good language to start with would be Python.

Member Avatar for Vic842
0
159
Member Avatar for knowledgelover

Why not store the information in a file? It's amazingly trivial to serialize objects into XML in .NET, so you might consider that path.

Member Avatar for JerryShaw
0
109

The End.