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

Then if you did write it (I'll believe you for now) why are you begging someone to finish it for you? Surely you are smart enough to do it yourself. I already told you there are only two things left to do. So get to doing them. We don't mind answering questions about what or how to do it, but please don't ask us to finish the program for you.

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

My guess is that you did not write the code you posted but copied it from someone else (plagiarism comes to mind). If you had written it then you would know how to finish the problem.

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

It is the same for all cases except references -- AFAIK that's the only way references can be initialized.

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

its done like this:

class Camera
{
public:
    Camera(Array2D& a): worldRef(a) {} 
    ~Camera() {}
private:
    Array2D& worldRef;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are almost done! :) All you have to do now is calculate the total points earned by the team and keep track of who earned to most points.

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

you can not typecase char* to wchar_t* because wchar_t is a different data type, under MS-Windows its a short, but under *nix its a long integer.

For string literals there is a macro in tchar.h address.streetAddress = _TEXT("Albareda 23");

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

For some reason there is a line through the text "Game Development" menu -- see attached. I only find that when currently browsing the C++ forum. I'm using FF on Vista Home. Dani I suppose you could tuck this away for later when you aren't busy doing anything else :)

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

Swap the entire structure, not just the time

struct players temp;
int a, b;

for (a=0; a < 32;a++)
{                

    for (b=0; b<32-a-1; b++)
        if (world[b].best_time < world[b+1].best_time)
           {
           temp = world[b];
           world[b] = world[b+1];
           world[b+1] = temp;
           }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Please do justify it with a small sample code
Why? You already said you had written the class, so why should I bother?

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

Isnt that an elvis or a jonny cash song or something? "boy named sue?"

Johnny Cash

Salem commented: The US has Jonnny Cash, Bob Hope and Stevie Wonder. The UK has no cash, no hope, and no bloody wonder! +29
jephthah commented: awesome +8
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A nuclear attack is perhaps the most real and immediate end of the world scenario. No monsters need to be thought up, no fiction created to make this apocalypse possible.

Go here to find out how you would fair in a nuclear attack.

For me:
Shockware: Shaken
Head Blast: Roasted
Fallout: Glowing

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

The U.S. Census Bureau statistics tell us that there are at least 88,799 different last names and 5,163 different first names in common use in the United States. Some names are more common than others.

There are 50,582 people named John Smith in the United States. There are 1,070 people named James Bond, 115 people named Harry Potter , 514 people named George Bush, and 32 people named Emily Dickinson. However, Johnny Cash (39 people) songs aside there are, statistically speaking, very few boys named Sue.

http://ww2.howmanyofme.com/

Naming your son Sue would definitely be child abuse :)

Nick Evan commented: Cash: The real king of rock 'n roll :) +16
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>does anyone know how i could do this
No, not I. But you could try this.

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

ArkM is right in that you don't need additional arrays. But the code he posted is way beyond what you have studied so far. You can do the program with two simple loops, which count the number of times each value appears in the array. Then just keep track of which value appears the largest number of times.

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

Ok, then just create two int arrays. The first array should hold the value and the second the number of times that value appears in the test[] array, which is the parameter to the function.

For each value in test[] your program will first search the values[] array to see if the it is already in that array. There are two possibilities:

  • The value in test[] does not exist in values[]. Add the value in test[] to the next available slot in values[] and set the quantity in the corresponding row of counts[] to 1.
  • The value in test[] already exists in values[]. In this case just simply increment the corresponding row of counts[] by 1.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

have you been taught structures yet? If not, you could do the same thing with two simple int arrays, one to hold the values and another to hold counts.

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

The program needs some way to keep track of the values and the number of times the values appear in the array. Then its a simple matter to find the value that appears the largest number of times

struct item
{
    int value;
    int count;
};

now build an array of the above structures and use it to keep track of how many times each number appears in the array passed to that function.

[edit]I didn't see the above two posts -- was busy working this problem out :) I would agree that map would be better than above, but that would depend on the OPs level of experience, and whether he is allowed to use std::map in his program. [/edit]

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

use ifstream class for file input. Add it in your code then repost.

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

Have you studied your text book? Have you paid attention in class (or even attended them) ? That assignment is not for beginners, but more likely mid-term or later. If you do not know what a pointer is then you will not be able to complete the assignment. Same with structures.

If pointers confuse you (which it does most people) here is a good tutorial.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
int main()
{
   const int length = 11;
   const int width = 14;
   int idx;
   char maze[length][255] = {0};

   for(idx = 0; idx < length; ++idx)
   {
       cin.getline(maze[idx], width+1, '\n');
   }
   for (idx = 0; idx < length; idx++ )
   {
         cout << maze[idx] << "\n";
   }
   cin.ignore();
}

Here is a more simplified version. The second parameter to getlin() is the line width which must be one more than the width of the maze to allow for the '\n' character. So if you want the width integer to be 14 then pass 15 to getline(). You can test that by typing one more character than you pass to getline(), the result is that getline() will not stop for keyboard input.

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

back to that same line: what is index? shouldn't it be random_integer ?

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

line 18: use the boolean operator == instead of the assignment operator =.

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

try this

#include <iostream>
#include <string>
using namespace std;


int main()
{
   int length = 0;
   int width = 0;
   int doorx = 0;
   int doory = 0;

  char** maze = 0;

   cin>> length;
   cin >> width;
   cin>> doorx;
   cin>> doory;

   maze = new char*[length];
   for(int i = 0; i < length; ++i)
   {
       maze[i] = new char[width+1];
    // Here you type all the characters you want on
    // this line before hitting the <Return> key.
       cin.getline(maze[i], width);
   }
   for ( int i = 0; i < length; i++ )
   {
         cout << maze[i] << "\n";
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If it's the input part that is giving you problems then why not just use getline() to input an entire line at a time. The >> operator will not allow you to input white space, but getline() will.

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

Seemed to work for me, after fixing a few things. I just hard-coded the strings because I didn't want to type them every time I ran the program :)

XXXXXXXXXXX
X X     XLX
XJXXXXXXX X
XXX X X XXX
X  SXXXXX X
XAXXX X XXX
XXX  XXX  X
X XXX X X D
XXX XXX X X
X BXX X X X
XXX   X X X
X   X
X X   X X X
    X

Press any key to continue . . .
int main()
{
   const int length = 15;
   const int width = 11;
//   int doorx;
//   int doory;
   char maze[width][length] = {
"XXXXXXXXXXXXX",
"X JX AX X X",
"XXXX XXXXBX X",
"X X SX X X",
"X XXXX XXX X X",
"X X X X X",
"X XXXXXXXXX X",
"X X X X",
"XXXXXX XXXX X",
"XL X X",
"XXXXXXXDXXX X"
   };
#if 0
  maze[length][width];

   cin>> length;
   cin >> width;
   cin>> doorx;
   cin>> doory;

   for(int i = 0; i < length; i++ )
   {
      for(int j = 0; j < width; j++ )
      {
         cin >> maze[j][i];
      }
   }
#endif
   for ( int i = 0; i < length; i++ )
   {
      for ( int j = 0; j < width; j++ )
      {
         cout << maze[j][i];
      }
      cout <<endl;
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post code.

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

I don't have a "bright" future -- I have a "brilliant" future:) and I only see it once. Maybe you have a problem with your browser. I am using FF on Vista Home. IE8 also does not have that problem for me.

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

You need to fix all the errors before attempting to execute the program. Compile it with a C compiler instead of C++ -- most c++ compilers will compile files with *.c extension as C code, not C++. There were about 90 errors when I tried to compile it with VC++ 2008 Express.

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

No one gets rep points good or bad here in Community Center Forum. Only get the colored dot on the post; does not affect overall rep points.

WaltP commented: Good answer!!!! :- +17
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

seems to have been fixed because I don't see that behavior. I see that you are only in the rough just once. So you must have gotten out of the rough a couple times :)

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

Enough of the personal insults. The next one will get a nasty infraction.

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

what is nfa and dfa -- expand the acronyms

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

Look under Web Development --> Web Design.

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

>>I'm only new to C++ and need urgent help with an assignment that's due tomorrow.
Procrastinating did you :) You can not leave programming assignments until the last minute, if you do you will fail the course. Programming takes lots and lots of time and effort.

Do the program one small piece at a time. Get the first part working then go on to do the next part. For example, your first task is to write a program to get the last name and sir name from keyboard. Use cout to display prompts and cin to get user keyboard input. You will need two strings, one for sirname and the other for lastname.

tux4life commented: Very good reply :) !! +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>would other stores be able to interact with other stores registers?

Yes you could compare the profits of one store against others, but you will have to add more information to those linked lists. But I'm not going to tell you how to do it. Get this part working first then you should be able to do that yourself.

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

why not just pass the linked list by reference

Link<std::string> filled;
//fill filled with data

TransferLink(filled);

//other file
void  Link<T>::TransferLink(Link<T>& start)
{
   // fill in the linked list here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need a good tutorial on pointers.. Pointers do not work the way you are attempting to use them.

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

Maybe something like this?

brand* head = NULL; // top of linked list
brand* tail = NULL; // linked list tail

int NumberOfBurgerKings = 0;
cout << "Enter the number of BurgerKings\n";
cin >> NumberOfBurgerKings;
for(int i = 0; i < NumberOfBurgerKings; i++)
{
    brand* restaurant = new brand;
    restaurant->next = NULL;
    cout << "How many registers for this store?\n";
    int nRegisters;
    cin >> nRegisters;
    for(int j = 0; j < nRegisters; j++)
    {
            // create linked list for this store
    }
    // now add to linked list
    if( head == NULL)  
    {
          head = tail = restaurant;
    }
    else
    {
         // add new node to end of linked list
         tail->next = restaurant;
         tail = restaurant;
     }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

re-read my previous post.

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

>>word = (word*)malloc(num * sizeof(word));

You can't malloc() a non-pointer variable. Change line 49 to char **word; then change line 60 to word = malloc(num * sizeof(char *)); You will have to redesign other parts of that code too. The loop that appears before the malloc() will not work after changing word to a pointer.

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

Oops, I didn't meant that?

Thought so :D

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

There is no such concept as "dereferencing and operator". Operators are like <, >, <=, /, +, etc. You probably mean dereferencing a pointer.

int n = 123;
int* p = &n;
*p = 0; // dereferencing a pointer
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>After deleting a pointer, you can never be sure what value it now has.

Disagree -- the pointer variable will contain the same address as it did before deleting it. The problem is the data at that address is subject to change at any time.

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

I'm afraid you don't understand the method.

brand* head = NULL; // top of linked list
brand* tail = NULL; // linked list tail

int NumberOfBurgerKings = 0;
cout << "Enter the number of BurgerKings\n";
cin >> NumberOfBurgerKings;
for(int i = 0; i < NumberOfBurgerKings; i++)
{
    brand* restaurant = new brand;
    restaurant->next = NULL;
    // now add to linked list
    if( head == NULL)  
    {
          head = tail = restaurant;
    }
    else
    {
         // add new node to end of linked list
         tail->next = restaurant;
         tail = restaurant;
     }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think you will be able to do that. AFAIK the referrals are part of the signup process, which is not public information.

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

When you use Windows Explorer to navigate to the release folder it will look something like the attached. If there is no *.exe file then your compiler failed to build the program. Make sure there were no compile errors.

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

Do you have PMs turned off in your control panel?

I don't know if there is a way to get them again or not.

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

well i gave him the executable file from debug folder .. how can i do what with release ?
.

Yes, that is most likely the problem because the other computer doesn't have the compiler's debug dlls installed. How to get release mode depends on the compiler you used, which you failed to mention.

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

You get PMs from Happygeek. Although honestly I have never heard of those people who mentioned me as a referral, at least I don't recognize their user names.

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

The problem is most likely DLLs. I have seen similar error on Vista. Make sure you compile the program for Release mode, not Debug mode. How to do that will depend on the compiler you are using.