Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CString has Left(), Right(), and Mid() methods which are something like std::string's substr() method.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

to be honest i just do it as good practice.

Well, its not "good practice" to use endl to often because all it does is slow down your program. I recall a couple unix operating systems that needed flushing often so that you could see the output on the screen quicker, but that was nearly 30 years ago -- operating systems have improved a tad since then. Instead of endl you can simply use '\n' to move the cursor to the next line.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

2x3x3 = 18, not 12. I suppose you meant 2x2x3??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For some really big challenges designed for people of all experience levels see Sane's Monthly Algorithm Challenges here. I have made the three most recent challenges stickies so that they can be easily found.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What I would do is sort each of the words and then just compare them. Example: orchestra and carthorse would both become acehorst. Don't use string leterals do so this because they can not be changed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is the code of ms office in c++??//

Send Microsoft a Billion dollars USD and they MIGHT let you see it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>can ypu help me?
Yes. But first you need to post the code you have tried to solve the problem. We are not a program manufacturer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use cout

int x = 12345;
cout << x;
Nick Evan commented: Sounds like a plan :) +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 57 and 58: you do not have to initialize the arrays one letter at a time -- just do the entire string at one time

char currentWord[] = "......"; /* The dot word */
 char guessWord[] = "monkey"; /* The word that needs to be guessed */

line 65: >> while (currentWord != guessWord) {
You can not compare two strings using the != or == operators. You have to call the function strcmp(), like this: while( strcmp(currentWord, guessWord) != 0){ strcmp() returns 0 when the two strings are identical (including letter case).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 19: you have to call the function sprintf() to format that string, like this: sprintf( dataDone, "[%s][%d%]", prog, loop);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The term "precompiled headers" means something completely different than what you are trying to do. You are tring to create a library of functions/classes that can be used in other projects. All you really need in those other projects is the *.h and *.o (or *.obj) files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Get the input data as a string, then your program can check its contents to see if it's numeric data or not. Since you are posting in the c++ forum I'd suggestion using cin and std::string, not scanf() or fgets() which are from C language.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

scnaf with %d will only accept numeric data -- anything else is ignored and scanf() does not change the value of the input parameter. Check the return value to see if scanf() successfuly converted any data.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please deposit $10,000 USD in my paypal account and you will get your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
int* A = new int[10]; // dynamic array

int A[10]; // simple array

If you want the explanation in words, then I'd suggest you look them up in your text book. There are also a lot of online explanations such as this one.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can erase an element from the map, but you can't delete just one of the pointers because it belongs to an array. If you allocate the pointers one at a time then you could delete them in any order you want.

map<int,particle*> particle_map;
for(i==0;i<number_of_particles;i++)
{
   particle_map[i] =   new particle;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'll catch it on DVD this spring.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That is Wal-Mart this year -- no Christmas music and no Christmas tree at the front doors. Its really sad that Wal-Mart isn't in the Christmas spirit this year.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What is that green tweet button with a number next to it used for? (located just under "Business Exchange" menu) Sometimes I see a 1 and other times a 0. Does that just mean Dani has posted something on tweeter.com?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's awful.
Never use system() on Windows ! (prohibited, see MS papers)
.

Link please. I've never seen Microsoft say systemI() was prohibited. If it was then why does M$ compilers support it?? I agree there are generally other ways to do it, but prohibited? -- I doubt it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
std::string ip1,ipc1;
    cout<<"Enter the Ip Address:\t ";
    cin >> ip1;
    ip1 = "ping " + ip1;
    system(ip1.c_str());
    ipc1 = "nbtstat -A" + ip1;
	system(ipc1.c_str());

The above won't work. Why? Think about the value of string ip1. After ip1 = "ping " + ip1" the string is something like "ping 192.1.1.1". Then when you way "nstat -A" + pi1" the string will be "nstat -A ping 192.1.1.1". I doubt that is the intent of what you want. You need to keep the ip address in a different string so that it doesn't change.

system("prompt $");
	system("shift");

C programs are not batch files, and can not be treated like one. The above two lines are fine in batch file but do nothing at all in C programs. In a C program if you want to display the $ symbol then just say this: print("$"); And there is no equivalent of Shift in C programs, other than maybe incrementing an integer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need an account on tweeter.com to make that work. It worked for me. BTW I'm Superman :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Who would want something like this,dont they care about thier privacy?

Apparently people who do that don't care about privacy -- probably lots of porn being streamed too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you live in the USA why not have everything shipped from amazon to your house, then you bundle all the books up and ship them to K however you wish. Everything from Amazon may or may not be shipped at the same time.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought you meant something like this:

<html>
<head>
<title>CODE Tag Test</title>
</head>
<body>
<?php
//Comment
echo "String!";
mysql_connect("localhost", "user", "pass") or die(mysql_error());
$b = 6;
$a  = $b++;
class dummy { private $value; }
include("text.php");
?>
</body>
</html>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

replace KeyType with int to see what happens.


>>void main()

Its int main()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It all depends on your compiler's memory allocation algorithms. Some compilers to not return deallocated memory to the operating sytesm; instead they keep it so that it can be reused.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could just say p1 = right.p1; but that could be dangerous if right ever goes out of scope or is destroyed. A safer approach is to allocate new memory for p1 and copy the contents of right.p1 into it.

A& operator=(const A& right)
{
    A a;
    a.p1 = new C;
    if( right.p1 != NULL)
       *a.p1 = *right.p1;
    return a;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You did not post anything that needed an assignment operator =. Assignment operators are not used in class declarations. Maybe you mean the overloaded = operator???

Your class doesn't have any public members, so none of its objects (p1 and p2) can be accessed outside the class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can specify the language, such as [code=html]. I don't know if you can successfully specify more than one language in the same post -- you'll just have to try it and find out what it does.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>what i mean is how to put a c++ compiler in the software

You mean you want to package a c++ compiler with your software? Bad idea. Just make them download the compiler from the original source so that they will always get the current version. Also it may not be legal for you to do that. I know vc++ 2008 Express is quite large and its *.iso file will occupy a large part of a DVD.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>but that doesn't let me differentiate between 32- and 64-bit operating systems which, at the moment, is the deciding factor for whether or not Windows enforces driver signing requirements

XP, Vista and Win7 all have 64-bit versions, so how is that going to help you determine which version is being run?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no standard way of doing that in C language. But one method is to use non-standard conio.h function getche(). If your compiler supports that function then you can use this program to find out what values your keyboard sends for any key on the keyboard, including arrow keys. Arrow and function keys are a little different than all the other keys because they produce two values, not one. So if the first time getche() return either 0 or 224 then there will be another value which will be the actual key. Special keys (function keys and arrow keys) have the same scan code as normal keys so you will want to change the key to tell your program that it is a special key. For example, pressing the right arrow on the arrow pad will produce the sequence 224 and 77. When the program gets 224 then it has to call getche() again to get the value 77. Since the value 77 duplicates another key you will want to do something with it that will identify it as a special key. Some programmers will just add 255 to it, making it 332. I usually just make it negative, or -77.

#include <stdio.h>
#include <conio.h>

int main (void)
{
    int c;
    while( (c = getche()) >= 0)
    {
        printf("%d\n", c);
    }
}

Experiment with the above program hitting various keys so that you can see what happens.

Next I would write a small function that returns the …

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

so what if i wanna put a function inside foo?

Not possible. C and C++ do now all you to nest functions (put one function inside the other).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't see any syntax errors, assuming array Games is part of that class or a global variable. But the function won't work. Why? See line 5.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

foo() doesn't just run -- when main() calls foo() the program's execution path will jump to the beginning of foo() and execute all the code in that function then return back to where it left off in main().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I'm using VC++ 6.0.

You won't be able to use that compiler if you think you need to write 64-bit code. Upgrade to vc++ 2008 Pro or the new vc++ 2010 Pro (the Express versions are not adequate either because they don't produce 64-bit code).

I know you can create 32-bit programs to run on a 64-bit os, but I'm not sure if 32-bit device drivers can run on 64-bit os.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to write two different functions, then in one of them you can call the other, like this

int foo()
{
    return 5;
}

int main()
{
    int x = foo();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <iostream>
#include <string>
using namespace std;

int main()
{
    std::string ip1;
    cout<<"Enter the Ip Address";
    cin >> ip1
    ip1 = "ping " + ip1;
    system(ip1.c_str());
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you try your2darray[y][x] = "Hello"; or this?

vector<CString>& s = your2darray[y];
s[y] = "Hello";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One way might be to enhance the daemon to listen on a socket in another thread and the other program can open the socket and send daemon some information.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no quick and easy solution because graphics is a complicated topic. You could do it by calling win32 api functions -- such as this intro tutorial. Or you could do it with a different language, such as CLR/C++, or C#, or VB.NET. Graphics is going to take a lot of complex coding in C or C++ languages. It might also be a bit easier if you using wxWidgets, which is a free download (just google for it and you will find it)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I already told you the problem -- line 55 doesn't work because 0 is never > than MONTHS. You changed the wrong line. You should have changed line 45, not line 55. Put line 55 back the way it was with < character.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What is wrong is that you are using some crappy compiler such as Turbo C to run an MS-Windows 32-bit program. Can't be done. Toss out that compiler and use a modern compiler such as Code::Blocks (with MinGW compiler) or VC++ 2008 Express -- both are free.

Also: the / character can not be escaped -- just delete the \ before /

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The ordering is not done in the code snipped I posted, but in the sort function you posted. On line 48 of post #9, change > to <

>>When I changed < to > it prints out nothing.
Of course it will print nothing because 0 is never > MONTHS.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have no idea what he is trying to say -- just looks like a lot of gobbledegook.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post #2 of this thread contains an algorithm you will need if you want to use a dynamic-sized array instead of a vector. Reallocating memory to expand the array's size can be a little complicated to understand for new programmers, so using a vector would be ideal.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yes sir , you are right.

but i am using GCC compiler.
it is not throwing any warnings or error for this.
switch with out case should be a error.

You are right -- Code::Blocks (which also uses MinGW ) doesn't produce warnings or errors on that either. VC++ 2008 Express produces a warning. I'm not familiar enough with gcc to know if there are any flags that will make that compiler produce a warning on it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only ways for Player to access functions in Map is one of the following

  1. Player is derived from Map, such as class Player : public Map
  2. The functions in Map are static and public.
  3. Player contains an instance of Map.