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

I'm generally only downvoting and neg repping spammers so no ham done :)

Why? You (or another mod) is going to delete the post anyway, so why bother?

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

Another difference -- the value of const char cannot be changed but the definition of #define's can be changed. That makes const char a lot safer to use than #define's

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

NULL is defined differently in c++ -- its defined as 0, while in C its defined as (void*)0. '\0' is the same as 0. I never use NULL for anything other than initializing pointers.

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

That will work too, as long as you swap only the data values instead of the whole node. The next pointers has to be kept unchanged.

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

You have to change HowMany() so that it displays the values of the 3 parameters. And those parameters don't have to be passed by reference. void howMany(int count1, int count2, int count3)

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

Post your newest code.

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

Hey thanks! :) but how do I insert the node into the right position? Does that mean I have to compare the input values so they would be arranged in an ascending order? That would mean i would use condition statement?

you are correct. You will have to use a loop to iterate through the linked list to find the correct spot for insertion.

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

I do down votes only (doesn't affect his/her rep) so that I don't destroy the member's overall rep with just my one vote. The post has to be pretty darned awful before I'll leave a down vote with comment and affect rep.

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

Here is a short tutorial

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

Have you tried this?

thines01 commented: Excellent Suggestion! +12
DeanMSands3 commented: Thank you, Ancient Dragon. You've changed my life, and my forum posting career, forever. +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its not "a company" but many companies/volunteer programmers with many different distributions of the operating system. One way they make money is on programming support.

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

It might simplify the program if you write two more functions: 1) a function that inserts a new node into the list in its correct position, and 2) a function that displays all the nodes in the list. Then main() can contain a simple loop

void InsertNode(node**head, node*p)
{

}

void DisplayList(node* head)
{

}

int main()
{
   node* head = NULL; // top of linked list
   node* p = NULL; // a new node
   while(true) // an infinite loop
   {
      p = new node;
      cout << "Give a number: ";
      cin >> p->data;
      p->next = NULL;
      InsertNode(&head, p); 
      DisplayList(head);
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i want something like this
i want to search a file for various data types and print the sizes of them acordingly

Post some examples of what will be in the file so that we don't have go guess that you want.

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

Dev-C++ probably because that is a 32-bit compiler, Turbo C++ no because its only a 16-bit compiler and therefore can not access any of MS-Windows operating system.

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

Your code compiled ok for me without errors or warnings using vc++ 2010 express. I just copied it all into one *.cpp file.

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

i try your code already, but got error......

I'm not a mind reader so you need to tell us what the error was and post the code.

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

Up or down voting a post anonymously doesn't affect the person's rep points. All it does is show whether or not you liked the post, nothing more. That is not the same as the question you posed in the poll.

zeroliken commented: I upvoted this post, Just because :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to use an array of ints, one for each task. Or if you know there will be only 4 tasks then you can use 4 different int counters

int count1 = 0, count2 = 0, count3= 0;
int main(){
int option =0;
bool exit = false;
while(!exit) {
displayMenu(option);

switch(option) {
case 1:
doTaskA();
count1++;
continue; 
case 2:
doTaskB();
count2++;
continue;
case 3:
doTaskC();
count3++;
continue;
case 4:
howMany(count1,count2,count3);

exit = true;
break;
default:
printf("Incorrect selection. Try again.\n");
continue;
}
}

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

The only way to find out how many times you executed the program is to write a value to a file or the registry. Programs can not retain values from one instance to another.

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

>>why it is assigned i=1

That's called initializing a variable to some known value. The value 1 was arbitrary, would have been any number. The important point is that the value is something that the author knows. Programmers would normally initialize variables to 0.

>>why it has given i<=10

So that the loop can count from 1 to (and including) 10. Had the value of i been initialized to 0 instead of 1, then the i<=10 would have been i<10. In either case the loop will execute 10 times.

>>why i++ is given after printf statement.
That increments the value of i by 1.

Another way that loop could have been written is like this

for(i = 1; i <= 10; i++)
{
    printf("\n %d x %d = %d", num, i, num * i);
}

When learning to program a good way to help you understand the code is to compile and test it yourself. don't be afraid to change the code a little to find out what happens, such as change i<=10 to i<10 and to change i=1 to i=15 (if you changed i=15 the loop would not run at all because the value of i is already greater than 10 )

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

>>EDIT : My project is a Windows Form type.

That is not c++ -- its CLI/C++ which is slightly different language

>>This can be done more easly with the webBrowser1 from Tools ?

Probably.

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

>> Error Msg is still there

What error message? Please post the exact wording. As I said before your program coompiled and linked ok for me without errors or warnings after I changed private: int a; to protected: int a;

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

It can be also easily done with C# and VB. But since this is c++ forum ...

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

Learn socket programming. How to do that will depend on the operating system you are using. If *nix you need POSIX sockets. MS-Windows use WinSocket.

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

Here is boost-html that might help you

IndianaRonaldo commented: Thanks!! I checked out that one too, but it doesn't have very good forum support, so I went with libxml2. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>It seems like Visual Studio 2010 compiler is complaining that despite all classes are in the same namespace, the abstract class's pure abstract method is not implemented.

I think you mis-interpreted the error message -- see comment below.

This works ok for me using vc++ 2010 express. The only change I had to make was make variable a in ParentClass protected so that it can be used in derived class.

#include "IBaseClass.h"
#include "ParentClass.h"
#include "concreteClass.h"
using namespace std;





namespace MyCustomNamespace
{
    void ConcreteClass::setB(const int bb) { this->b = bb; } 
    const int ConcreteClass::getB() const { return this->a; }

    bool ConcreteClass::Method001(/*some input*/)
    {
      //implementation code goes here...
        return true;
    }
} /*NAMESPACE*/


    int main()
    {
        MyCustomNamespace::ConcreteClass c;
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In the example posted, yes they are all undefined behavior. Here is more in-depth explanation.

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

Its always from left to right even if there are parentheses in the expression. The example you posted displays undefined behavior, meaning there is no consistent result among compilers.

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

>>Contest details will be announced soon.

What's the current status of this contest? It's been 7 months and have not heard anything about it, or maybe I just missed it.

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

>>There are some certifications that are nice to have and others that are simply "must haves" in today's competitive job market.

Certifications only help you get a job. Two people with identical education and experience, the one with certs will probably get hired. None of the are needed for entry level jobs.

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

well, you must understand, that the machine you would use as a 'server', you can easily place underneath your desk, while the servers you compare them to were bigger than the room you put your desk in :)

That reminds me of the first computer I saw, was in 1963, the computer was housed in 4 floors of a concrete building with no windows. I didn't work in computers those days but I did get a chance to see it -- rows and rows of large vacuum tubs, must have been millions of them. That computer had less memory than the one everyone now has on their desk at home.

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

Class definitions are normally put in header files, which are included in the *.cpp file. This is done do that the class can be used anywhere within the program, not just main(). Right now you are probably writing very simple programs that contain only a main() function. What would you do with a program that has hundreds or even thousands of functions? You can't (or don't want to) define the same class over, and over for hundreds of times at the beginning of each function that needs it.

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

Hard to tell without seeing the structure. Also you should be checking the return value of SystemList::GetNode() for NULL so that the program doesn't try to write out a NULL pointer.

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

Is sizeof(SystemNode) == 8192??? Please post that structure/class.

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

Of course object files *.o or *.obj can be linked just the same as *.a and *.lib files, every programmer does it all the time.

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

You would want to learn QT if you want to write a cross-platform program. QT is a compiler that produces GUI programs for both *nix and MS-Windows from the same exact source code.

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

Since when? Have they changed something since I've been in school?

You are right, 4>=1 is true. But I think what is going on is that the program is comparing true (1) with the value of x, which is 3.
Z>=y is true (1)
1 >= x is false

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

The reason they teach DOS programming is because its a lot easier to learn then win32 api. New programmers don't yet have the skills needed to program win32 api.


Another reason may be the old and ancient compilers/IDEs some schools use, such as Turbo C. They are too old to code for win32 api.

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

>>,z>=y>=x

The evaluation is always left to right, not right to left. Z >= y, or 4 >= 4 is true, and 4 >= x or 4 >= 1 is false, so the result is 0.

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

Learning win32 api is good because you learn how things work. You can easily write MS-Windows GUI using higher-level languages such as CLI/C++, Windows Forms, C#, or VB.NET, but to know how the engine really works you need to study win32 api. I can easily drive a car all my life without ever looking under the hood, but many people are not satisfied with that, they want to know how the car operates. If you want to be a mechanic then you will have to look under the hood and get your hands greasy.

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

Don't let that turn you off -- you can use whatever variable names you want. If you are talking about the data types, then yes you will just have to learn to deal with them. Although DWORD is just a define for unsigned long int, you should use DWORD because Microsoft might change it in the future. They already did that for some data types when they wrote the 64-bit operating system. If you used unsigned long int instead of DWORD, and Microsoft decided to change it to __int64 then your program wouldn't work on the new os.

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

That works ok for me using vc++ 2010 express.

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

How to do that all depends on the compiler and/or IDE you are using. Basically, a library is nothing more than a collection of compiled functions that are in a file with *.lib or *.a file name. *nix computers also have something called shared libraries, which has a *.so file name.

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

You are right. You might have to synchronize access to info if you have a multi-threaded program and two or more threads try to access info at the same time. You don't have to worry about that if your program has only one thread.

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

Correction: vector<string> Players::info;

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

>>printf evaluation will be done right to left

I think you misunderstood the lecturer.

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

Depends on what the external symbol was. Did you see the second part of my answer, or does that error refer to something else (the error message should have told you the name of the symbol)?

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

make the vector static.

class Players{
public: static vector <strings> info
};

Then in one of the *.cpp files declare it again as if it were a global variable

// Players.cpp
#include "Players.h"

Players::vector<string> info;
thines01 commented: Direct / wise +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We used Visual Studio where I worked which did a great job of organizing large projects that contained several related executable programs, libraries and dlls (all called a "solution"). You can set up dependencies so that when you ask VS to build the entire solution (meaning compile all libraries, dlls, and executables in the solution) the IDE will know when to bild what and in what order they need to be compiled.

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

Drop both those compilers because they are too old. Get free Code::Blocks (with MinGW compiler) or VC++ 2010 Express. You can easily compile libraries with either of those compilers/IDEs.