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

try it in a tiny program and you will find out. The best way to find out such things is to write a little program to test it yourself, you will learn a lot more that way.

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

Is MainWindow::MainDlgProc() a static method? Only static methods can be used as callback functions.

Check out this link

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

Wish granted. Everyone but you are now zombies.

deltascrow commented: epic reply +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

do you mean you want to list all members so that they are ordered by teamid? Or do you just want to select rows which have temaid = 2?

Do you know SQL? If not, then you need an SQL tutorial

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

Learn to program first.

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

the declarations are in header files so all compilers will provide them just like they provide all other header files.

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

does the same 'iostream' file have codes for both windows and linux?

To us programmers they are all the same code, the operating system is transparent to the programmer. For example your program uses cout the same way on all operating systems, and that's because there is an international c++ standard. The c++ standards committee dictates to all compiler vendors what functions/classes have to be implemented, but do not say how the functions/classes are to be implemented. You can write cout << "Hello World\n the same way with all c++ compliant compilers. We are not normally concerned about how compiler makers implement standard c++ functions/classes , unless of course you write your own compiler or work for a company that make compilers.

you kind of missed this question
Yes, that was my answer to #4, not #3.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  1. because it's in the std namespace, as are all the other classes in the fstream and iostream header files.

  2. dont' know, but Mike probably does

  3. Yes, because they are implemented by different compilers. The same iostream is implemnentsed by all c++ compilers, that doesn't mean they are all implemented in the same way. All the underlying code is operating-system dependent. We as programmers just don't see it.

where can I find the real code of iostream

If you have a c++ compiler then you already have it, or most of it. Just read the header files, but be warned that the header files are nearly undreadable. Some of the source code is in libraries or DLLs or shared libraries, depending on the compiler. To see that you will have to spend a lot of $$$ to buy it from the compiler vendors, except for open source compilers such as gnu. In that event, just download all the gnu compiler's source code and read to your heart's desire.

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

I would be in favor of a feature similar to "flag bad post" but for an edit request, for small edits like fixing formatting.

You mean we can't do that now??? Just hit Flag Bad Post and comment "add code tags" or some other editing problem.

I don't like the idea of non-mods editing posts -- too dangerous no matter how good the intent. As I said earlier, all members already have the ability to suggest mods edit posts for some reason.

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

. I think it is not a good thing to learn. right

Wrong. You will never go wrong learning something.

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

Doesn't really matter because the world is coming to an end in 13 days (21 Dec). :)

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

I have it off too, and for the same reason. Nobody's business what I'm doing.

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

You will have a lot easier time reading/writing the Movie structure if you replace the std::string with char arrays, something like below. std::string can not be easily written to binary files.

In c++ program I like to use a constructor to initialize the data rather than initializing the data in some other function or class. Structures are almost identical to class in c++.

struct Movie
{
    char sTitle[126];
    char sA1[80];
    char sA2[80];
    unsigned int sYear, sTime;
    Movie()
    {
       memset(sTitle,0,sizeof(sTitle));
       memset(sA1,0,sizeof(sA1));
       memset(sA2,0,sizeof(sA2));
       sYear = sTime = 0;
    }
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You mean you want to work on your vacation? Take some time off from programming and do something else, like skiing, sky diving, or scuba diving. Or just relax, go to the beach and watch the girls go by.

mrnutty commented: They don't realize that these young days are very precious. Preach AD preach! +0
nitin1 commented: hahaha... awesome. i already have a girl friend. :p +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh yes, I know how that goes. You can close the thread youself by marking it Solved.

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

why are you using an online compiler? There are several free compilers that you can download and compile on your computer, assuming you are using your own computer instead of one located in some public place like a library or at school.

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

line 59: notice the pointer is local to the constructor. As soon as the constructor ends the pointer goes away and all memory alloted to it is lost (memory leak).

Correct the problem by allocating memory for the pointer that is declared in the class, like this:
this->Participants = new Participator*[size];

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  1. remove ///\\ and see if that removes the warning

  2. lines 106, 108 and 109: fprintf() is missing the first parameter FILE*, see line 97 for correct syntax.

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

It supports other languages too. But if you are using C++, which compiler and version of the compiler? Which version of CE? Are you writing MFC or something else?

Most c++ compilers for CE support FILE*, and some newer compilers also have limited support for fstream class. The last I knew CE did not support the concept of a working directory, so _chdir() is not supported.

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

In the program that is in separate files you have to prototype the thee functions that return doubles because the compiler doesn't know what they return and assume they return an int, which is not correct.

Put the three prototypes before main()

double hamCalc(double,double);

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

Your question doesn't make any sense. The variables you declared on line 8 have a value of whatever happened to be at the memory addresses, it could be 0 but it could also be any random value. That's not a bad thing because the program changes the values by calling scanf(). My only suggestion here is to use "%lf" instead of "%f" because %f if for floats and %lf for doubles.

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

Now, my first question is, do I try and run the 'burger.c' file or do i compile the created 'burger.o' file because when I try the .o file it says 'cannot execute binary file'.

you don't do either. You can only run the executable. Add the -o filename to the gcc line. If -o is missing gcc will default the filename to a.out So in your example run ./a.out

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

It is skipping the line that calls getline() because you are mixing formatted and unformatted data input. When someone enters something he/she always presses the <Enter> key. cin>> does not extract it from the keyboard buffer, so when getline() is called it thinks its the end of data input.

To solve the problem you have to remove all keystrokes from the keyboard input buffer before calling getline() after using >> operator. N ote the use of your getline() was also incorrect. See correction below.

#include <limits>

...
...

cout<<"Enter Last name"<<endl;
cin>>readData[n].lastname;
cin.ignore( numeric_limits <streamsize> ::max(), '\n' ); // empty the keyboard buffer
cout<<"Enter Address"<<endl;
cin.getline(readData[n].address, sizeof(readData[n].address));

cout<<"Enter Cell number"<<endl;
cin>>readData[n].cell;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What you want is the win32 api function SHGetSpecialFolderPath(). This function is used to get path to several different operating system-dependent paths. For example if you want the path to "c:\Program Files(86)". The macro in the 3d parameter is defined in this list.

char path[MAX_PATH];
SHGetSpecialFolderPath(
    0,
    path, 
    CSIDL_PROGRAM_FILESX86, 
    FALSE ); 

For versions Vista or newer you may want to call SHGetKnownFolderPath() instead of the above.

64-bit version of MS-Windows always have both c:\Progrm Files and C:\Program Files(x86), so your program must know which one it wants. There is no win32 api function that will return the path to just one or the other of the folders.

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

Since when did Microsoft ever invent anything original?

<M/> commented: Hahaha :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Purle is ok, it just needs a scattering of pink polka dots :)

purple_polka_dots1

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

which one you use might depend on what the callback function is going to do with it. If the callback function is going to change anything in the string then use the first one because the second is (probably) a pointer into read-only memory.

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

You need to pass the head of the linked list by reference rather than by value. That means functions need two stars, not one.

For this function, since you are adding the new node to the head of the list an if statement isn't necessary. But you see that it needs a pointer to a pointer so that this function can change the address of the caller's pointer.

void push_node(struct node **node, int data){
    struct node *new_node = (struct node *)malloc(sizeof(struct node));
    new_node->data = data;
    new_node->next = *node;
    *node = new_node;
}

 int main(){
struct node* head = NULL;
push_node(&head, 10); // <<< see change on this line
push_node(&head, 2); // <<< see change on this line
display_node(head);
getchar();
return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you try this?

Mike Askew commented: Ah the classic link! +0
Prysm[VA] commented: I approve. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to check that the file was opened successfully. Put this after line 16

if( !infile.is_open())
{
   cout << "Error opening file\n";
   return 1;
 }

line 19: move the declaration of x up outside the loop so that it can be used to index into the array.
line 20: use the index value instead of 51 infile>>list[x++]; Change line 21 like that too.

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

call strlen() to find the length of sentence then set a pointer to that position. In a loop you will have to decrement instead of increment the pointer so that you get the string in reverse order.

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

line 10: You are treating modify as if it were of type std::string, it isn't. modify is of type char* and character arrays don't have methods like begin() and end().

lines 3-5: What is the purpose of those lines? You can't convert a single character as you declared on line 3 as a character array. The pointer sentence should already point to a string of characters. What you probably want to do is convert from char* to std::string

std::string modify = sentence;

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

So where am i wrong in my code???

Reread my previous post because I already told you what's wrong.

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

I think you need to use dynamic_cast instead of static_cast. Read the requirements for derived_class here and here As indicated in the second link if you use virtual functions in base class you may not need casts at all.

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

Dani applied voting flooding control a couple years ago when DaniWeb was under vBulletin because another member did something similar. Maybe you need to implement it here.

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

if ("symbol = +")

When doing comparisons you have to use == operator, what you have above is an assignment operator. Don't get the two operators confused even though they look alot alike.

Second problem with the above line is remove the quotes and put ' around the + symbol. Here's how it should look.
if( symbol == '+')

Next, use { and } to enclose multi-line statements such as those if statements in your program.

if (symbol == '+')
{
     result = numb1 + numb2;
      cout<<"the sum is :"<< result <<"\n";
}
GokuLSSJ4 commented: I tried it is still the same +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To extend a little what phorce wrote, the pointers don't have to be pointers to arrays, but can be pointers to a single object such as a single integer. What exactly to pass to Func depends on how Func() is written. It could be either of the following, depending on the content of Func().

The second example below is very similar to the first example that phorce posted, except phorce allocated the array dynamically and I did not. Allocating the arrays dynamically is usually done when the size of the array is not known then the program is compiled, something else determines its size. Each approach is ok, as long as you realize that dynamic allocations is baggaged with the cause of many bugs and long hours debugging.

// pass pointer to a single integer
int main()
{
   int num = 1;
   Func(&num));
}

// pass an array
int main()
{
   int num[5] = {1,2,3,4,5};
  Func(num);
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem is that all those macris the rc file are not defined. Create a file named english.h and define them there. It doesn't matter what numbers you assign to them as long as there are no duplicates.

// english.h
#define IDM_NEW 1
#define IDM_OPEN 2
#define IDM_SAVE 3
#define IDM_EXIT 100
#define ID_OPTIONS_SHOWTOOLBAR 500

Then include english.h at the top of english.rc

#include "resource.h"
IDR_MENU MENU DISCARDABLE
{//BEGIN

    POPUP "File"
// rest of the rc file goes here
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Gone with the Wind

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

The problem is not that there is violence, cursing and sex in the movies, because these things are sometimes necessary to make meaningful points about related topics / moral issues.

Bullshit! I don't have to watch two or more people having sex together to know about the problems of sex. I don't have to listen to commedians using the F word whenever it suits him to know about ghetto problems. I don't have to watch one person cutting off another person's fingers to know about drug deals. Hollywood puts all these things in movies purely for profic, just for the $$$.

<M/> commented: Good use of language and a good point with it :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You shouldn't say "Hollywood" and "morals" in the same sentence :) Hollywood lost all morals years ago when they started producing R rated movies which contain lots of violence, cursing and sex.

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

If you put car.h in the same folder as car.cpp the compiler should not have a problem finding it. If you put car.h in some otherr folder you will have to tell the compiler where it is, as stated by other members who have posted here. For small projects just put everything in the same folder unless you are instructed to do otherwise by your teacher.

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

You don't want to do that scanf() stuff because the array has already been filled in the TableFill() function. All you want to do here is just use a loop that counts from 0 to n and sum up the values that are in the array.

variables named sum and average will need to be double instead of int because the array is an array of doubles.

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

I want to have enough money so as not to work anymore in my life

Be careful what you wish for -- rich people actually work harder then poor people because they have to keep what they have and that's not an easy task. Bill Gates can lose Billions $$$ very easily, I don't have to worry at all about that :) :)

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

put lines 1 thru 8 in a header file
put the remainder in a .c file
at the top of the .c file include the header file that you created in the first step
create the make file

Once you do the above you need to finish writing the functions in the .c file. For example function tableAverage() is incomplete. You need to sum all the values in the array then divide the sum by the number of elements in the array.

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

It's not just WalMart, BestBuy and Target were similar to that too.

Not all americans are berserk like that..

Yes we are :) :)

No walmart shopper has an IQ over 30 unfortunately.

There are some very smart people who shop in WalMart, just not very many of them. Check out some of these photos if you don't believe me :)
Click Here

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

live 5 more years
lose some weight
see my great-grandchildren (none yet)
go bungee jumping
go skydiving
win the tax-free lottery

<M/> commented: you probably get more than 5 years :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For all our non-American friends here at DaniWeb this is a video that shows you what Black Friday means in America.

http://techcrunch.com/2012/11/23/a-glimpse-of-the-apocalypse-walmart-customers-fight-over-phones-on-black-friday/

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

vector<string> db(string input)

That function doesn't return anything.

Echo89 commented: Thanks! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Grand Canyon in Arizona USA