278 Posted Topics

Member Avatar for Lance5057
Member Avatar for ThrasherK

What isn't working? What is the result, and how does it differ from what you expect?

Member Avatar for thelamb
0
290
Member Avatar for kerp

It makes absolutely sense that this doesn't make sense at first sight ;). [code=cpp] void Reallocate(char* Source) [/code] Here, Source is a _copy_ of char* Buffer. So modifying what Source points to will leave Buffer completely untouched. Only if you modify the thing-that-Source-points-to you will also modify the thing-that-Buffer-points-to .. …

Member Avatar for kerp
0
117
Member Avatar for claudiordgz

It could be me, but I really don't understand what you're asking - could you be more specific please?

Member Avatar for thelamb
0
176
Member Avatar for nickx522

Did you google what the toupper function does? What parameters does it take etc.

Member Avatar for WaltP
-2
69
Member Avatar for brycematheson

The board is small, so you don't need any fancy search strategy... Take this as example: [code] int row1[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 2 }; bool isInRow = false; for( int i = 0; i < 9; ++i ) if( row1[i] == NewNumber ) …

Member Avatar for Fbody
0
132
Member Avatar for inbarda

It's impossible to say with this example. Where do you call waiting(), and where do you call getID()? How do you make sure that the clock* is valid? Maybe the Clock object that you passed by ref. to the constructor has already 'died' when you call getID(). So better show …

Member Avatar for thelamb
0
66
Member Avatar for simul8or

... is not an operator, are you sure he did not mean . ? Check: [url]http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B[/url] I guess the most common use of ... is in try/catch blocks: [code=cpp] try { } catch( ... ) { } [/code] This will catch all C++ exceptions

Member Avatar for mike_2000_17
0
121
Member Avatar for jae5086
Member Avatar for pandaEater

Why do you catch in this function, immediately after you throw? If you remove the try catch in this function, you will have to catch it at the caller's side (and this function will not return). For example: [code=cpp] try { myHeap.top() } catch( const char* e ) { cout …

Member Avatar for pandaEater
0
135
Member Avatar for Rez11

Some comments: strlen already returns the correct length, you don't need to decrease the length to account for the null-char. I don't think the revString is necessary. You can define a pointer to the start of string, and one to the end.. compare them and increase the first pointer, decrease …

Member Avatar for Rez11
0
127
Member Avatar for stark025

A lot is wrong... Compile with -Wall (enable all warnings) and it will tell you which functions are deprecated. As a first sweep: don't use anything from conio.h

Member Avatar for stark025
0
261
Member Avatar for gpjacks

#1 : Your vector 'quantity' is uninitialized, which means you are trying to print garbage. #2 : Your loop is suppose to _fill_ the vector, now you are just printing it out like in #1. Also, the loop counter must be named x, not the vector itself. So if I …

Member Avatar for gpjacks
0
266
Member Avatar for rlhh

So the code you pasted works? Since card_list is in the class. + are you sure the _compiler_ is crashing? Please give us the smallest source that reproduces the problem.. including all files that we need (e.g. the card class etc.) - then we can give better suggestions.

Member Avatar for rlhh
0
192
Member Avatar for bigman91

You can start by writing an empty main function, and other functions that the question states (ReadDials) etc. put the 8 char variables in main, and call ReadDials with those 8 variables.

Member Avatar for Purrenhage
0
1K
Member Avatar for .:Pudge:.

The max of rand() is system-dependent. Show us what you are doing, there may be a different reason for your program crash.

Member Avatar for Tellalca
0
105
Member Avatar for KellieD

Don't include 'as soon as possible' in your topic and post... it is rude and even made me consider not replying to you at all. You are defining the function SumN inside the body of main()... that is wrong. Each function must have its own scope. Besides that, you say: …

Member Avatar for SgtMe
0
153
Member Avatar for Stefano Mtangoo

Why not public (or protected, if the classes are related) getter/setter functions? If that doesn't make sense then I'm not entirely sure what your problem is, in that case... could you elaborate with an example?

Member Avatar for Stefano Mtangoo
0
105
Member Avatar for lochnessmonster

I don't really understand your question... The decision between throwing in error-cases or returning a status code is a design decision... advantage of trowing exceptions is that if you don't catch them, the program will crash, where if you just return a status code (e.g. FALSE) the caller can ignore …

Member Avatar for thelamb
0
106
Member Avatar for ntgsx92

What are the types of one, two and three in this example? [code=cpp] char myString[20]; ??? one = myString; ??? two = myString[2]; ??? three = &myString[2]; [/code] strcpy takes a char* as first and second argument.

Member Avatar for ntgsx92
0
103
Member Avatar for manofhouse

errno_t strcpy_s( char *strDestination, size_t numberOfElements, const char *strSource ); You forgot the number of bytes you want to copy.

Member Avatar for thelamb
0
381
Member Avatar for sairakhalid

How would you do this if p was a 1 dimensional array? It doesn't make sense to try and work out how 2D arrays work unless you have good knowledge of 1D arrays. So show us that you can do this with a 1D array, then I'm sure we can …

Member Avatar for sairakhalid
0
130
Member Avatar for Syrne

First of all, I'd like to congratulate you on making a good post, we don't see it too often anymore around here! Firstly, I would rename 'getStudent' to 'newStudent' or something simmilar, I think it reflects the purpose more accurately. Now, newStudent is responsible for gathering all the information needed …

Member Avatar for Syrne
0
183
Member Avatar for HBK_100

You expect 9 variables, but the line only contains 8. Plus, the types that are in the file must match the types of the variables. E.g. if the line is "hello" Then: [code=cpp] int firstWord; file >> firstWork; [/code] won't work. Lastly, you should put extra braces around the file …

Member Avatar for thelamb
0
88
Member Avatar for Rez11

You should make calcArea a pure virual funtion, by defining it as: [code=cpp] virtual void calcArea() = 0; [/code] Right now the compiler thinks that this function is unimplemented. The calcArea in the derived shapes don't necessarily need to be virual.

Member Avatar for Rez11
0
968
Member Avatar for somon

Here's a beginning: [code=cpp] int main( int argc, char** argv ) { return 0; } [/code] Now, please show some effort and actually _try_ for yourself. If you then have specific questions how to do something, ask again (and SHOW us what you have done yourself).

Member Avatar for m.e.nergiz
0
121
Member Avatar for xikkub

I'm not entirely sure if put overwrites the content at the current position (although I see no reason why it shouldn't). Can you try using f.write with a size of 1 ?

Member Avatar for xikkub
0
234
Member Avatar for natha_peepli

It means that >> will return a reference to its base class, in this case istream. This allows the programmer to 'chain' >> together: cin >> iTest >> cTest >> iTest2; etc.

Member Avatar for thelamb
0
85
Member Avatar for bookmark

Why did you put the word double there? grossPay already returns a double. So you can just remove the word double on line 10.

Member Avatar for bookmark
0
452
Member Avatar for morgon

How are you compiling? Do you use an IDE? It seems that Node.cpp isn't being compiled (e.g. no Node.o is created).

Member Avatar for gerard4143
0
113
Member Avatar for BryantFury

'ticket' is an integer, but you expect your user to input 'A', 'B' etc. What could go wrong? You should check if the cin >> ticket is even succeeding, before trying to use 'ticket' in the switch case.

Member Avatar for Tom83B
0
107
Member Avatar for format_c

You want an array of size i, but i is a runtime variable. The compiler is giving you this warning because it has no idea how much space to allocate for Acts. You should look up dynamic memory allocation, or re-design your solution using STL containers.

Member Avatar for thelamb
0
190
Member Avatar for lasl0w

C strings are 0 terminated, you are correctly creating the chars with size 81, and copying only 80 bytes to them, but what is the value of the last char? Exactly... it is garbage data. So, you must initialize the char array to zero, you can do this in several …

Member Avatar for lasl0w
0
9K
Member Avatar for Tiny_trixer

Your cin >> in; (request the user for input) is outside the do...while loop. So you ask input once and then it's continuously 'executing' the switch case with the same 'in' value.

Member Avatar for Tiny_trixer
0
117
Member Avatar for muze

[QUOTE]Lastly, the function that takes "Test" I believe takes a slightly bigger datatype than const char* try prefixing it with L--[/QUOTE] That depends if the OP is building with Unicode or multi-byte support.

Member Avatar for thelamb
0
178
Member Avatar for Intrade

There is an installer package for boost, it's mostly .1 version behind the latest build but that should not matter. [url]http://www.boostpro.com/download/[/url] They support 2010, and allow you to install various builds (static multithreaded, dynamic multithreaded etc. etc. etc.) And you're in luck... it is for the latest version ;)

Member Avatar for thelamb
0
110
Member Avatar for mitrious

Everything is the same except the last parameter to 'transform'. So why don't you pass this argument to 1 analysis function? [code=cpp] double analysis( const vector<Student_info>& s, type_of_last_param_to_transform t ) { ... } [/code] I've intentionally left out the type of the last parameter to transform, I assume you can …

Member Avatar for mitrious
0
141
Member Avatar for Violet_82

Exceptions do not exist in C, so including the stdlib won't do any good. I don't know the exact details, but maybe Visual C++ accepts 'catch' without any specification as to what you want to catch, and g++ doesn't. In any case, I suggest you specify what exceptions you want …

Member Avatar for thelamb
0
164
Member Avatar for ButterFly21
Member Avatar for Nick Evan
0
141
Member Avatar for cosnersx

Your use of brackets indicates that you don't fully understand the do...while. You're writing your code like: [code=cpp] do { ...something } while( light == false ); { ...do something else } [/code] There are no statements in the do...while that will ever change the light boolean, and the part …

Member Avatar for cosnersx
0
97
Member Avatar for bufospro

Never flush the input stream with fflush [code=cpp] fflush( stdin); // wrong! [/code] There is a sticky on this forum that nicely explains how to deal with this problem.

Member Avatar for stevanity
0
103
Member Avatar for NoMoreKawasaki

Think about what you're doing. You know that if you want a max random value of 20, you do: rand()%20; So this will generate something between 0 and 20. Now the problem starts when you try to deal with the min value, you simply add min(10) to the randomly generated …

Member Avatar for Unimportant
0
94
Member Avatar for patticus

The 'math' in your if statements is very sloppy, it's hardly readable what's going on. First off, why are you doing stuff like [code=cpp] if( (g.y/3)*3 == something ) [/code] g.y/3 * 3 is the same as g.y So the two if reads: [code=cpp] if( g.y+k == g.y && g.x+l …

Member Avatar for thelamb
0
92
Member Avatar for newbiecoder

You are including gradebook.h from two files, so the compiler will parse it twice. By doing so it will throw errors because of something like 'XXX already defined in blabla.o'. To prevent this, you should always 'guard' your header files. So GradeBook.h should be: [code=cpp] #ifndef GRADEBOOK_H_INCLUDED #define GRADEBOOK_H_INCLUDED // …

Member Avatar for newbiecoder
0
160
Member Avatar for diagramatic

I find a lot of things important, here is a summary: [code=cpp] int myFunction( int arg1, int arg2 ) { if( 2 == arg1 ) // would throw error if I'd write 2 = argc1 by mistake return; // And I generally thing it makes sense to write the constant …

Member Avatar for mike_2000_17
0
186
Member Avatar for daviddoria
Member Avatar for mrnutty
0
220
Member Avatar for adman_2005

Be more precise in your question.. else you are unlikely to get homework help. This encrypt function you pasted(next time use code tags please), is it exactly like in your code? If so... the compiller errors should be obvious enough... So, tell us what errors you are getting, why do …

Member Avatar for jordan00191
0
419
Member Avatar for DeweyFinn

You can't read the letter a from a file, and then assign a variable with the name a really dynamically. I guess if the variable names that you read from the file are only a,b,c etc. you could put them in an array, using the integral value of 'a' as …

Member Avatar for Ancient Dragon
0
93
Member Avatar for medopunsher

CreateThread doesn't take a pointer to a class's method, let's read the error message together: Your argument type: 'DWORD (PMessenger:: )(void*)' Expected arg type: 'DWORD (*)(void*)' So CreateThread is expecting a pointer to a function that returns a DWORD and takes void* as argument. There are several ways to 'beat' …

Member Avatar for Stefano Mtangoo
0
115
Member Avatar for shahanakazi

Why do you want to convert the numbers to string first, and then back to integer? I guess you want to do this so that from "93" you can get the 9 and 3 seperately and do the calculations... but that would actually prove that you haven't even read the …

Member Avatar for dusktreader
-1
174

The End.