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

I prefer ebook because I can change the font size to whatever I like, because ebooks aren't as heavy as paper books, and because people don't chop down any trees to create ebooks.

iConqueror commented: agreed +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, but you will have to post it because my eyes are not good enough to see your monitor from where I am sitting.

AFAIK there are no win32 api functions named PutText() and GetText().

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

call srand() at the very beginnning of the program, and before the first time rand() is used. Usually srand() is called with the return value from time() so that srand() gets a different number every time it is called. That will prevent rand() from returning the same set of numbers each time you run the program.

srand((unsigned int)time(0));

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

Does it mean that if i put for example

Yes, you got it correct :)

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

im afraid if i understood this assignment unproperly:

Seems pretty clear assignment to me. What part don't you understand?

Since you have to work with each digit of the number it would probably be easier to get the number as a string instead of an integer. It can be done with an integer but it's a little more complicated.

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

Unless it's a binary file where you know the offset to the data you want, the only way to read the pieces you need is to read the whole file then extract the data from that. With text files it's impossible to seek to the data because you never know exactly where it's at.

First read a line of the file into std::string, then use string's find() method to search for the colon. That will give you the position within the string where the colon is found. use substr() to extract the rest of the line and do whatever you want with it.

You might also be able to do that with getline() using the colon as the separator.

std::string str;

ifstream in("filename.txt");
while( getline(in,str,':')
{
    getline(str,'\n');
    int var = atoi(str.c_str());
}
butterfingerss commented: So you're saying that it would be easier in a binary file? +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to include stdlib.h

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

Like so,this works for me:

You need a different compiler.

I think it is possible to do that

You can not have one function inside another function in either C or C++ languages. You can declare a function prototype inside a function, but the function itself has to be coded outside any other function.

#include <stdio.h>
#include <string.h>

int main()
{
  char name[5][50];
  int numofname = 5;
  int i;

void getname(char name[][50],int numofname); // this is ok

 for( i = 0;i < 5; i++)
   getname(name,numofname);

 for( i = 0;i < numofname; i++)
    printf("%d : %s\n", i, name[i]);

  return 0;
}      
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't, you have to buy them.

Ravi_16 commented: However , you can use trail for 30 days from the time of installation :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here are some books that may help you. Experience is probably the best teacher. IMO most of the features of Visual Studio are just fluff, the best and most useful feature is it's debugger. One feature I don't like is it's dockable windows -- I'm always accidently undocking one of them and spend a lot of time and effort trying to put it back the way it was. I wish there was a way to lock all those windows in place so that they can't be moved.

You might want to upgrade to Visual Studio 2013 Express. It's c++ compiler more closely implements c++ standards than earlier versions.

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

But you quoted the wrong person. I'm the one who made comments that Mike quoted in his post.

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

Is input[1] just a single numeric digit? If it is, then you don't need any conversion program, just subtract '0' to convert it to integer.

For example:

char input[] = "X1";
int x = input[1] - '0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The gun tax was applied in 1937, long before today's gun problems.

Statistically, one of the primary uses for firearms is to commit suicide

Where did you get that bit of misinformation? According to National Center for Health Statistics (link), there were 2,169,518 deaths in the USA, of those 1,441 were from firearms and 30,810 were suiside (about 60% involved firearms). According the that same article there are approximately 200 million firearms in the US. I don't see any statistical significance in that, even considering the data is now pretty old.

A more recent article (2005) shows that American's own guns for one or more of three reasons: protect themselves against crime, for hunting, and for target shooting.

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

"%c" only gets one character from the keyboard. I see the structure contains several character arrays, so "%s" is probably more appropriate. Also, it's not necessary to use & before character arrays because they are already passed as pointer by default. For example

scanf("%s",stud.vpisna_st);

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

Here's an article about a year old that you might find interesting about Democrat votor fraud.

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

The world's longest living married couple are Karam and Kartari Chand, living in Bradford, UK. They have been married over 88 years! (link)

The only nation in the world to have a nonrectangular flag is Nepal (link), located in the Himalayas and bordered to the north by the People's Republic of China. The first time I recall seeing it was at the Olympics in Russia a few weeks ago.

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

You have static data in some of the classes that also need to be declared globally in one of the *cpp files. Static class data is just like normal global data except they contain the class scope operator.

For example you might declare them in main.cpp like this example

#include <iostream>
#include <cstdlib>
#include <cctype>
#include <string>
#include "Balls.h"
using namespace std;

int Basket::count = 0; // <<<<<<<<<<<<<<<<<<<<<

int main(int argc, char* argv[]){
    if(argc!=6){
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's all right here -- Bush would still have won had there been a recount. But this is 15 year-old news and not worth repeating.

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

While the other networks waited for official results, Fox News just went ahead and called it for Bush.

How can you claim Fox elected Bush when what they did doesn't affect voting ?? You sound like you are still just pissed off because Bush was elected. Bad looser. Get over it. You need to pay more attention to Canadian politics instead of American politics where you have no say one way or the other. Of course US could always make Canada it's 51st state, then you could vote in American elections.

But we digress, lets get back on topic.

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

in which George Bush was elected by Fox News

That never happened.

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

Change the return type of each function to return the value of c and y, then in the third function you can get those values to compare them. Something like this:

int foo1()
{
   int c = 5;
   return c;
}

int foo2()
{
   int y = 0;
   return y;
}

int foo3()
{
   int c = foo1();
   int y = foo2();
   return c == y;  // returns either 1 or 0 (true or false)
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Per head of population it must have been murder capital of the US!

I've always thought that amusing too :) Then she went off to teach college -- AFAIK she has no formal education other than probably high school. She was just an old widow who decided to write a book one day. Is that all the qualifications it takes to teach college nowdays???

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

Study and work full time with c++ for about 10 years and you will become a master at it.

Schol-R-LEA commented: That's what it would take, for sure. +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Wasn't it in Iraq when Saddam Hussein held free elections he got 100% of all the votes :)

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

Republicans aren't the only party guilty of that. Democrates are guilty as well, here in St Louis area a few years ago there were many dead people who voted Democrat. Seems that only happens when Republicans are winning.

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

Since you are using Visual Studio, place the cursor on one of the open {, press Ctrl+] and it will move the cursor to the matching closing }. In the case of your program you are missing two closing braces at the bottom of the code you posted.

Good coding and indentation practices helps a lot to quickly identify such errors.

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

First create the empty functions what you need.
Next copy the code from the swith statement into the functions
Finally, replace the code in the swith statement with function calls.

How do you call a function? Very simply like this (which you have already posted):

Binary2Decimal();

john.kane.100483 commented: Can you make an example. Use my program us an example. +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's not a question, it's simply a statement of the program you have to write. -- we don't do homework for people. You write the program then ask specific question(s) about what you don't understand.

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

5ec5c6cffeddfadcd44f0b599daf0631

This post has no text-based content.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 15 of the original post increments ptr within the loop, which is ok. But ptr is not reset back to the beginning of the array before the next loop starts on line 18. On line 19 ptr is beyond the end of the array so (ptr+i) is always invalid.

Fix the problem by copying line 9 to a new line just before line 18.

Then ptr = &arr[0] should be written as ptr = arr

It doesn't really matter one way or the other, both are correct and the compiler won't care which way you code it.

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

Like I said, that won't compile for the reason you just posted. In your program one of the parameters to the friend function must be a reference to LargeInteger class. If that is not needed, then don't make it a friend function.

So I need to use *&, what's the name of such construct, pointer address, and how is it different from a pointer(

The & makes it a reference to a pointer, something similar to **. Since str1 and str2 are both pointers, you can do away with the & operator and just pass the pointers.

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

if (str != str2)

Since the memory for str and str2 are allocated at runtime they two address will never be the same. Lines 10 and 14 are reversed, line 8 will always be true so there is nothing wrong.

Since str1 and str2 are really pointers, here is how to write the code

class CustomString
{
public:

    std::vector<string> vec;
};



class LongInteger
{

    friend bool operator== (CustomString *&str1, CustomString *&str2);
    friend bool operator!= (CustomString *&str1, CustomString *&str2);


public:


private:
    vector<string> vec;

};

bool operator!= (CustomString *&str1, CustomString *&str2)
{
    std::vector<string>::iterator s2 = str2->vec.begin();



    for (std::vector<string>::iterator s = str1->vec.begin(); s != str1->vec.end(); ++s)
    {


*
        if (*s2 == *s)
        {
            cout << *s2 << *s << endl;

            return false;
        }


        ++s2;
    }

    return true;
}

int main()
{
    CustomString *str = new CustomString("helloworld");

    CustomString *str2 = new CustomString("helloworld");


    if (str != str2)
    {
        cout << "everything is ok" << endl;
    }
    else
    {
        cout << "something is wrong" << endl;
    }

    return 0;
}

That still won't compile because the two operator lines in class LongInteger are incorrect.

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

How you write it is a little unconventional, but should still compile ok. You just have unnecessary parentheses.

for(std::vector<string>:: iterator s = str1.vec.begin(); s != str1.vec.end(); ++s)

I can't really say what the problem is without seeing the whole program.

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

line 7 is incorrect -- instead of ++i it should probably be ++s.

does line 14 show that *s and *s2 are the same strings?

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

Click Here

When you hit cancel should the editor put that text into the post?? If yes, then what's the purpose of the Cancel button?

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

lines 12 and 15 are wrong. According to line 27 the parameter to multiply() is not a callback function, but just a simple integer.

int multiply(int a, int x)
{
    int r = x; 
    int e = a * r;
    return e;
}

If you really intend to pass the add() function as a parameter, then do something like this. Note that since add() takes two parameters, main() must supply those values on line 27, OR multiply() must supply them itself.

int multiply(int a, int(*x)(int, int),int b, int c )
{
    return a * x(b,c);

}   

If you want main() to supply the two parameters to main(), line 27 would look like this:

cout << multiply(10,add,2,5) << endl;

Otherwise if multiply() is to supply the two parameters

int multiply(int a, int(*x)(int, int) )
{
    return a * x(2,5);

}   

cout << multiply(10,add) << endl;
furalise commented: Well constructed answer. +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

SetParents() does not need a reference to a pointer -- just the pointer

_clients->at(FreeIdx).GetPlayer()->SetParents(this, __clients->at(FreeIdx));

When passing a poitner by reference the & operator is not used in the actional function call, only in the function prototype and function header. The & in the actual function call makes it a pointer to a pointer, not a reference to a pointer.

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

You write the code, we only answer questions.

rubberman commented: Subtle as always AD. :-) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pirate Grammer

2b7ae93554145df953308912de591394

Reverend Jim commented: I love it. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

VS has never recognized anything other than .h extension by default, so I doubt that is the problem. Most likely the .h file was added to the project as a compileable file just like the .cpp files. If that is the case then just simply remove the file from solution. Don't delete it from the file system or project folder, just from VS Solution Explorer window.

rubberman commented: Thanks AD - I haven't used VS for a LONG time. I'd rather get a good whack upside the head instead! :-) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What operating system? What compiler? I would't do that -- it would take years to duplicate what other teams of programmers have already done, especially if you want cross platform. QT is probably one of the best free cross-platform GUI compilers, actually I think it's just an IDE and works with other compilers such as GCC, MinGW, and CL (M$ compiler).

But if you really insist on doing your own thing them be my guest. For MS-Windows you need to lear win32 api GUI -- it's all C language, not C++ but can be called from C++ as well. Here is a tutorial to get you started.

*nix isn't so easy as win32 api, if you want to start at the bottom you will have to learn X11R6. There are dozens of manuals that you can buy from amazon.com.

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

I don't like India spices, too hot for my blood.

Stuugie commented: I really don't get mlk3's comments, neither here nor in my PMs. Oh well, I don't like India spices either. :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

more like Make love, no war.

Nope -- your daughter is right. (link)

Another way to say it is "Make love, make no war"

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

No. But google might.

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

My guess is that Turbo C is just too old a compiler to do what you want -- 16-bit programs don't have very much memory so it may not be able to load the image. In that case the only solution is to use a modern compiler.

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

I try not to criticize people who don't know English, they most likely write in their own language then use a translator to translate into English. Those translators aren't very good sometimes. I don't know a second language but if I had to write a question in French for example my writing would be horrible to a native French person.

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

Install the 32-bit version of the device driver if you compile vb.net for 32-bit program, which is I think the default. Are you using Visual Studio 2010 PRO because the Express version only compiles 32-bit programs.

I had a similar problem then found out that I had installed the 64-bit version of the device driver because my computer has 64-bit Windows 8.1. Uninstalled it and installed the 32-bit version of the device driver fixed the conflict.

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

There's generally two layers of software -- os kernel which has direct access to all hardware, and application programs which are protected from direct hardware access. What you are asking is how to write os device drivers, which run at the kernel level. For MS-Windows you will need these tools. Here are some other links and tutorials to get you started.

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

If it's Windows 8/8.1 then please read this article

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

what thread are you talking about? You need to post a link to it.

Where is the start menu in Windows 7?

Are you kidding??? The Start menu is in the left most side of the toolbar. You can't miss it unless you're blind.