Forum: C++ Oct 20th, 2009 |
| Replies: 3 Views: 203 double calculateAverage(double Number, double Sum)
{
return (Number * 1.0) / Sum;
}
You have to divide Sum by Number , not the Number by sum. |
Forum: C++ Sep 8th, 2009 |
| Replies: 19 Views: 612 as the way you speaks you know nothing about C++ right ? you know C up to now.So that ithelp's C book will do the best for you and I recommand it.
Anyhow it's not a free book. Anyway if you can... |
Forum: C++ Sep 2nd, 2009 |
| Replies: 6 Views: 372 delete is a C++ keyword so use a different identifier other than
delete.
and also use the delete keyword to delete the arrays that you no
longer using. ( I mean inside that function ).... |
Forum: C++ Sep 2nd, 2009 |
| Replies: 7 Views: 283 dev is a IDE not a compiler , the compiler that dev uses is the mingw.
can I know precisely why you need to implement a new #pragma
directive. for me I rarely use ( less than 10) pargma... |
Forum: C++ Sep 2nd, 2009 |
| Replies: 7 Views: 283 nop visual C++ does provide you some #pragma directives.
But it not let you to extend this.
These are the only pragma that you can use.
... |
Forum: C++ Apr 18th, 2009 |
| Replies: 26 Views: 1,642 just get the stack trace and get see what's the function calls it until
you find your code.Then check the parameter values. |
Forum: C++ Apr 18th, 2009 |
| Replies: 3 Views: 294 Hmm , good question , I have the past experience with dealing these
type of question. where you have to consider is list <myPacket> will
have a default constructor and a copy constructor and a... |
Forum: C++ Apr 10th, 2009 |
| Replies: 7 Views: 851 #include <iostream>
using namespace std;
class car {
public:
car (float speed) :
speed(speed) {}
car () :
speed(0) {} |
Forum: C++ Apr 10th, 2009 |
| Replies: 7 Views: 851 I have compiled your mentioned source by the microsoft C++ compiler too. the same error message is there.
error C2385: 'racetank::car' is ambiguous
So it's not a compiler bug or compiler... |
Forum: C++ Apr 4th, 2009 |
| Replies: 10 Views: 1,792 l seen soemthing like this in the OpenCV libraries. |
Forum: C++ Mar 26th, 2009 |
| Replies: 13 Views: 449 It's oky , try to get the value as a return value. Or there are other ways.
But for now ( for easy underestand ) try it using a return value. |
Forum: C++ Mar 26th, 2009 |
| Replies: 13 Views: 449 #include "include.h"
#include "menu.h"
#include "exit.h"
#include "login.h"
int main()
{
int success =0;
login(); |
Forum: C++ Mar 26th, 2009 |
| Replies: 13 Views: 449 you should return 0 if success otherwise return -1
#include <include.h>
#include <exit.h>
int login()
{
string username; //This is a string variable calld username(string variables r 4... |
Forum: C++ Mar 26th, 2009 |
| Replies: 13 Views: 449 you should let execute printMenu() call if only success. If not just print a "Invalid user " message.
you can change your method
void login()
to
int login(); |
Forum: C++ Mar 25th, 2009 |
| Replies: 5 Views: 369 IDEA:
if you want to write
Player p ;
[code]
like that you should define the default values for your overloaded constructor .Like this
[code]
class Player{
private: |
Forum: C++ Mar 24th, 2009 |
| Replies: 14 Views: 1,169 WPARAM is availiable in the LowLevelMouseProc procedure.
I think you can use it.
and you can process that structure to get x and y values out.
see... |
Forum: C++ Mar 24th, 2009 |
| Replies: 5 Views: 369 If you overload the default constructor then the compiler no longer put a default constructor ( this is not just a rule there is a reason for this think why ? )
So you can't say
Player p ; |
Forum: C++ Mar 24th, 2009 |
| Replies: 5 Views: 369 and for your first question (C2512) , just google that error and
you will find the answer. I can't post duplicate here. It's violation of member rules.
the problem is think that , if you call
... |
Forum: C++ Mar 24th, 2009 |
| Replies: 5 Views: 369 #include "stdafx.h"
class Player{
private:
int x;//player x/y position
int y;
public:
Player(int _x, int _y);//constructor |
Forum: C++ Mar 24th, 2009 |
| Replies: 14 Views: 1,169 I don't know this will be really useful . Sounds like there is no direct way to just pass it directly. looks like You have to use the LowLevelMouseProc and it's LPARAM is the
pointer to... |
Forum: C++ Mar 24th, 2009 |
| Replies: 14 Views: 1,169 These information are simple. WPARAM HIWORD contains the y location and the WPARAM LOWORD contains the x position.
EDIT: Opps sorry ,
MouseProc doesn't input that LPARAM no ?
anyway I write a... |
Forum: C++ Mar 24th, 2009 |
| Replies: 14 Views: 1,169 are you trying to write a keylogger or something like that ?
am I correct ? Then using that program you are recording something
. some key strokes and mouse evens like this.
Yes you can do this... |
Forum: C++ Mar 22nd, 2009 |
| Replies: 17 Views: 1,087 double P[1000], V[1000], T[1000];
Next time try to use a STL vector for this . you can make a struct that contains int P , int V and int T and make a vector of that struct. And Feel free to... |
Forum: C++ Mar 20th, 2009 |
| Replies: 12 Views: 563 You means a dialog ?
well here is the source code . Note that DLG_MAIN is comming from the resource.h. That ID that you given in the resource editor.
#include "stdafx.h"
#include <windows.h>... |
Forum: C++ Mar 20th, 2009 |
| Replies: 12 Views: 563 here is a tutorial if you using Dev C++ IDE.
http://www.technohug.net/profiles/blogs/1987837:BlogPost:75464 |
Forum: C++ Mar 20th, 2009 |
| Replies: 12 Views: 563 There is nothing special way to use it. It's like you asking how to use the notepad in windows.
Just design your resource using the resource editor. and save it where your project source files... |
Forum: C++ Mar 19th, 2009 |
| Replies: 5 Views: 372 good you have taken some courage .
if you still can't underestand why look at this code and
think why ?
int simDiceThrow(int maxNumber, int &total)
{
int pvalue; |
Forum: C++ Mar 19th, 2009 |
| Replies: 6 Views: 797 class enigma
{
private:
public:
enigma()
{
cout << "new enigma" << endl;
plug_board board_1;
reflector reflect_1; |
Forum: C++ Mar 19th, 2009 |
| Replies: 5 Views: 372 if (isEvenSided(pvalue) != false) {total++;}
How can you compute the total outside the loop ? you should
pass the total also as a reference. And inside the function you
can make it to zero... |
Forum: C++ Mar 16th, 2009 |
| Replies: 5 Views: 290 if your input set ( problem space ) is a random set. Then burte forcing is the only way. Even backtracking is also impossible. |
Forum: C++ Mar 3rd, 2009 |
| Replies: 5 Views: 836 #include "stdafx.h"
#include <iostream>
using namespace std ;
#include <string>
using std::string ;
#include <windows.h> |
Forum: C++ Mar 3rd, 2009 |
| Replies: 5 Views: 836 * Edit using the L prefix to the variables
Looks like the latest versions of the C++ specification allows.
However no one is going to keep all the spec in mind.
sorry about it.
however... |
Forum: C++ Mar 3rd, 2009 |
| Replies: 5 Views: 836 typedef char* LPCSTR;
typedef wchar_t* LPWCSTR;
#ifndef _UNICODE
#define LPCTSTR LPCSTR;
#else
#define LPCTSTR LPWCSTR;
#endif |