Solved

URGENT...C++ Pointers to objects

Posted on 1998-10-31
37
235 Views
Last Modified: 2010-04-02
This program program should use the class as an object (define the object with use of a pointer) that will display the "bank menu".

The program should run until Quit is selected.  When 1-5 is selected, the number of coins of that denomination is what should be entered by the user.  Option 6 displays the total cash amount on screen and 7 displays the total number of coins of each denomination on screen.

(My code is in three files: .h, .cpp and main.cpp -- this is how we are learning to program it-- the header file should remain as is).

...Here is my code (which does not work...I am lost in pointers and what exactly to do in my functions...!!!  Help!!!  I need this to work before Monday a.m.  I'm using MSVisual C++ compiler v.5.

Thank you!

//bank.h
class bank  
{
  public:
    bank();
    bank(bank&);
    virtual ~bank();
    void DisplayTotal();
    float GetTotal();
    void AddDimes(int);
    void AddNickels(int);
    void AddPennies(int);
    void AddQuarters(int);
    void AddLoonies(int);
    void DisplayBreakdown();

  private:
    int Loonies, Quarters, Dimes, Nickels, Pennies,             userInsert;
    float Total;
};

//bank.ccp
#include <iostream.h>
#include "bank.h"

bank::bank()
{

}

bank::bank(bank&)
{
  Loonies=0, Quarters=0, Dimes=0, Nickels=0, Pennies=0,   userInsert=0;
  Total=1;
}

bank::~bank()
{

}

void bank::DisplayTotal()
{
  (*transact).GetTotal();
}

float bank::GetTotal()
{
  return
  ((Dimes*.10)+(Nickels*.05)+(Pennies*.01)+(Quarters*.25)+(Loonies*1));
}

void bank::AddDimes(int Dimes)
{
  if(userInsert>0)
  {
    Dimes=userInsert;
  }
}

void bank::AddNickels(int Nickels)
{
  if(userInsert>0)
  {
    Nickels=userInsert;
  }
}

void bank::AddPennies(int Pennies)
{
  if(userInsert>0)
  {
    Pennies=userInsert;
  }
}

void bank::AddQuarters(int Quarters)
{
  if(userInsert>0)
  {
    Quarters=userInsert;
  }
}

void bank::AddLoonies(int Loonies)
{
  if(userInsert>0)
  {
    Loonies=userInsert;
  }
}

void bank::DisplayBreakdown()
{
      
}

//bankmain.cpp
#include <iostream.h>
#include "bank.h"

void main (void)
{
  int Loonies, Quarters, Dimes, Nickels, Pennies, selection,   userInsert, Quit;
  float Total=1;
  bank *transact;
  transact=new bank;

  do
  {
    cout<<"\nPiggy Bank Menu\n\n";
    cout<<"1) Insert Pennies\n";
    cout<<"2) Insert Nickels\n";
    cout<<"3) Insert Dimes\n";
    cout<<"4) Insert Quarters\n";
    cout<<"5) Insert Loonies\n";
    cout<<"6) Display Current Total in Bank\n";
    cout<<"7) Display Coin Breakdown in Bank\n";
    cout<<"0) Quit\n";
    cout<<"\nPlease enter your selection:  ";
    cin>>selection;

    switch(selection)
    {
      case 1:
        cout<<"\nPlease indicate number of Pennies inserted:         ";
        cin>>Pennies;
        (*transact).AddPennies(Pennies);
      break;
      case 2:
        cout<<"\nPlease indicate number of Nickels inserted:         ";
        cin>>userInsert;
      (*transact).AddNickels(Nickels);
      break;
      case 3:
        cout<<"\nPlease indicate number of Dimes inserted:          ";
        cin>>userInsert;
        (*transact).AddDimes(Dimes);
        break;
      case 4:
        cout<<"\nPlease indicate number of Quarters         inserted:  ";
        cin>>userInsert;
        (*transact).AddQuarters(Quarters);
        break;
      case 5:
        cout<<"\nPlease indicate number of Loonies inserted:         ";
        cin>>userInsert;
        (*transact).AddLoonies(Loonies);
        break;
      case 6:
        (*transact).DisplayTotal();
        break;
      case 7:
        (*transact).DisplayBreakdown();
        break;
      case 8:
        if(Quit=1)
        {
          cout<<"\nExiting program!\n\n";
        }
        break;
      default:
        cout<<"\nInvalid selection!\n\n";
        break;
    }
  }while(selection!=0);
}
0
Comment
Question by:appreciative
  • 22
  • 14
37 Comments
 

Author Comment

by:appreciative
Comment Utility
This question is not supposed to be in <unlocked> I've just posted it...it has not been answered yet!!!
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
1.  Does the code compile?
2.  If it does, which of your tasks have or have not been completed correctly?
0
 

Expert Comment

by:Eliezer
Comment Utility
You aren't calling the initializer bank(bank&).  You're calling the initializer bank(), which doesn't clear any of the data members.  That's your main problem.  As far as I can tell, you're not doing anything wrong with pointers - although, if this were my program, I would declare transact as:
bank transact;
Which takes care of all the allocation/deallocation/dereferencing problems by making it a automatic or stack-based variable.  You still need to clear the members in bank(), however.

Other notes:

If bank(bank&) is a copy constructor it should be bank(const bank&).
Inserting pennies sets the number of Pennies, rather than adding Pennies.  
It often clears up a lot of confusion if you name the local variables "thePennies" and the members "mPennies".
I don't know why you have the "Total" data member or local variable, because it's not doing anything I can see.
DisplayTotal() gets the total and does nothing with it - doesn't print it out or anything.
DisplayBreakdown() doesn't do anything.
case 8: should be case 0:
Nobody is initializing Quit or setting it when it's time to Quit.
Where are the warnings on your compiler?  They should have caught this stuff.  Check your preferences.
0
 

Author Comment

by:appreciative
Comment Utility
Thanks Eliezer,

My compiler gives a 0 error, 1 warning of "double to float" for the GetTotal...the only function that works is Quit....when I call my functions in main, ex. pennies, the user enters number of pennies but the DisplayTotal , the GetTotal and Breakdown functions do nothing (well I haven't entered anything in the Breakdown, I actually don't know what to enter....!!!!!!!!!
Thanks for answering to promptly...
Appreciative  
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
It appears as if you want to use bank *transact globally.  Therefore you have to move its declaration out of main and into your header file.

If one of the specifications of your assignment was to use the header file exactly as it is shown above, you will have to pass *transaction as a parameter to some of your functions.

It appears that the only function that is using *transact is your display total function.
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
First of all, get rid of your display total function altogether.  This will allow you to leave your *transact in main.

The total is being added up, but you are doing nothing to print it.
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
OK, I just realized you would have to change the header file to et rid of display total.  Leave it in and I will see what I can do with it.
0
 

Author Comment

by:appreciative
Comment Utility
Hi Scrapdog,

I just sent you a message Scrapdog, but I had a server problem and it did not go through, trying again....

I'm trying to get the function DisplayTotal to display amount of cash on screen and DisplayBreakdown to display coins in each denomination....I tried cout<<(*transact).DisplayTotal and the same for Breakdown but the compiler give me approx. 10 errors... I know I'm not managing my pointers correctly, but I don't know what to do with them!!!!

Thanks++++

Appreciative


0
 

Author Comment

by:appreciative
Comment Utility
Hi Scrapdog,

I just sent you a message Scrapdog, but I had a server problem and it did not go through, trying again....

I'm trying to get the function DisplayTotal to display amount of cash on screen and DisplayBreakdown to display coins in each denomination....I tried cout<<(*transact).DisplayTotal and the same for Breakdown but the compiler give me approx. 10 errors... I know I'm not managing my pointers correctly, but I don't know what to do with them!!!!

Thanks++++

Appreciative


0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Before we go any further, I noticed several logic errors in your main.

Change your main to look like this:


void main (void)
{
  int userInsert, Quit;
  float Total=1;
  bank *transact;
  transact=new bank;

  do
  {
    cout<<"\nPiggy Bank Menu\n\n";
    cout<<"1) Insert Pennies\n";
    cout<<"2) Insert Nickels\n";
    cout<<"3) Insert Dimes\n";
    cout<<"4) Insert Quarters\n";
    cout<<"5) Insert Loonies\n";
    cout<<"6) Display Current Total in Bank\n";
    cout<<"7) Display Coin Breakdown in Bank\n";
    cout<<"0) Quit\n";
    cout<<"\nPlease enter your selection:  ";
    cin>>selection;

    switch(selection)
    {
      case 1:
        cout<<"\nPlease indicate number of Pennies inserted:         ";
        cin>>userInsert;
        (*transact).AddPennies(userInsert);
break;
      case 2:
        cout<<"\nPlease indicate number of Nickels inserted:         ";
        cin>>userInsert;
(*transact).AddNickels(userInsert);
break;
      case 3:
        cout<<"\nPlease indicate number of Dimes inserted:          ";
        cin>>userInsert;
        (*transact).AddDimes(userInsert);
        break;
      case 4:
        cout<<"\nPlease indicate number of Quarters         inserted:  ";
        cin>>userInsert;
        (*transact).AddQuarters(userInsert);
        break;
      case 5:
        cout<<"\nPlease indicate number of Loonies inserted:         ";
        cin>>userInsert;
        (*transact).AddLoonies(userInsert);
        break;
      case 6:
        (*transact).DisplayTotal();
        break;
      case 7:
        (*transact).DisplayBreakdown();
        break;
      case 8:
        if(Quit=1)
        {
          cout<<"\nExiting program!\n\n";
        }
        break;
      default:
        cout<<"\nInvalid selection!\n\n";
        break;
    }
  }while(selection!=0);
}


You do not need Pennies, Dimes, etc. in main, all you need is userinsert.  As far as your other two headers, I will get back to shortly.  I got it to compile just fine.
0
 

Author Comment

by:appreciative
Comment Utility
Here is my compile error (only one...fortunately) when I do a cout<<(*transact).DisplayTotal;

Compiling...
bankmain.cpp
C:\Windows\Desktop\cplus\bank\bankmain.cpp(54) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
Error executing cl.exe.
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
First, I forgot to declare "selection" in main above, so change it to:

int userInsert, selection, Quit;

Then change all your Add functions to the following:


void bank::AddDimes(int userInsert)
{
  if(userInsert>0)
  {
    Dimes=userInsert;
  }
}

void bank::AddNickels(int userInsert)
{
  if(userInsert>0)
  {
    Nickels=userInsert;
  }
}

void bank::AddPennies(int userInsert)
{
  if(userInsert>0)
  {
    Pennies=userInsert;
  }
}

void bank::AddQuarters(int userInsert)
{
  if(userInsert>0)
  {
    Quarters=userInsert;
  }
}

void bank::AddLoonies(int userInsert)
{
  if(userInsert>0)
  {
    Loonies=userInsert;
  }
}


Notice that the only thing that changed is the parameter.  You originally called it Dimes, Quarters, etc. when it should be userinsert (userinsert is the amount you are adding, dimes,quarters,etc. are the amounts of money already in the bank).
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Your display breakdown function can look something like this:

void bank::DisplayBreakdown()
{
  cout<<" pennies "<< Pennies << "\n";
  cout<<" nickels "<< Nickels << "\n";
  cout<<" dimes "<< Dimes << "\n";
  cout<<" quarters "<< Quarters << "\n";
  cout<<" loonies"<< Loonies << "\n";
}

You might have to change it a bit to get the desired formatting!!
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Get rid of the line:

float total=1;

in your main.  total isn't used anywhere.
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
bank::bank()
{
  Loonies=0, Quarters=0, Dimes=0, Nickels=0, Pennies=0,   userInsert=0;
  Total=1;
}

Do your initialization in bank::bank().  Get rid of bank::bank(bank&).
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Displaytotal could look like this:

void bank::DisplayTotal()
{
  float total = GetTotal();
  cout << total;
}

Again, you will have to format it to how you want it!!
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Get rid of the variable "quit".  It doesn't do anything.

And as suggested by Eliezer:

case 0:
       
        {
          cout<<"\nExiting program!\n\n";
        }
        break;

rather than case 8!!!
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Finished product:


#include <iostream.h>

class bank  
{
  public:
    bank();
    virtual ~bank();
    void DisplayTotal();
    float GetTotal();
    void AddDimes(int);
    void AddNickels(int);
    void AddPennies(int);
    void AddQuarters(int);
    void AddLoonies(int);
    void DisplayBreakdown();

  private:
    int Loonies, Quarters, Dimes, Nickels, Pennies,             userInsert;
    float Total;
};


bank::bank()
{
  Loonies=0, Quarters=0, Dimes=0, Nickels=0, Pennies=0,   userInsert=0;
  Total=1;
}


bank::~bank()
{

}

void bank::DisplayTotal()
{
  float total = GetTotal();
  cout << total;
}


float bank::GetTotal()
{
  return
  ((Dimes*.10)+(Nickels*.05)+(Pennies*.01)+(Quarters*.25)+(Loonies*1));
}

void bank::AddDimes(int userInsert)
{
  if(userInsert>0)
  {
    Dimes=userInsert;
  }
}

void bank::AddNickels(int userInsert)
{
  if(userInsert>0)
  {
    Nickels=userInsert;
  }
}

void bank::AddPennies(int userInsert)
{
  if(userInsert>0)
  {
    Pennies=userInsert;
  }
}

void bank::AddQuarters(int userInsert)
{
  if(userInsert>0)
  {
    Quarters=userInsert;
  }
}

void bank::AddLoonies(int userInsert)
{
  if(userInsert>0)
  {
    Loonies=userInsert;
  }
}

void bank::DisplayBreakdown()
{
  cout<<" pennies "<< Pennies << "\n";
  cout<<" nickels "<< Nickels << "\n";
  cout<<" dimes "<< Dimes << "\n";
  cout<<" quarters "<< Quarters << "\n";
  cout<<" loonies"<< Loonies << "\n";
}



void main (void)
{
  int userInsert, selection;
 
  bank *transact;
  transact=new bank;

  do
  {
    cout<<"\nPiggy Bank Menu\n\n";
    cout<<"1) Insert Pennies\n";
    cout<<"2) Insert Nickels\n";
    cout<<"3) Insert Dimes\n";
    cout<<"4) Insert Quarters\n";
    cout<<"5) Insert Loonies\n";
    cout<<"6) Display Current Total in Bank\n";
    cout<<"7) Display Coin Breakdown in Bank\n";
    cout<<"0) Quit\n";
    cout<<"\nPlease enter your selection:  ";
    cin>>selection;

    switch(selection)
    {
      case 1:
        cout<<"\nPlease indicate number of Pennies inserted:         ";
        cin>>userInsert;
        (*transact).AddPennies(userInsert);
break;
      case 2:
        cout<<"\nPlease indicate number of Nickels inserted:         ";
        cin>>userInsert;
(*transact).AddNickels(userInsert);
break;
      case 3:
        cout<<"\nPlease indicate number of Dimes inserted:          ";
        cin>>userInsert;
        (*transact).AddDimes(userInsert);
        break;
      case 4:
        cout<<"\nPlease indicate number of Quarters         inserted:  ";
        cin>>userInsert;
        (*transact).AddQuarters(userInsert);
        break;
      case 5:
        cout<<"\nPlease indicate number of Loonies inserted:         ";
        cin>>userInsert;
        (*transact).AddLoonies(userInsert);
        break;
      case 6:
        (*transact).DisplayTotal();
        break;
      case 7:
        (*transact).DisplayBreakdown();
        break;
      case 0:
       
        {
          cout<<"\nExiting program!\n\n";
        }
        break;
      default:
        cout<<"\nInvalid selection!\n\n";
        break;
    }
  }while(selection!=0);
}


I compiled it as one file, so you will have to break it back up into three separate files (this shouldn't be too hard!!!).

Hope this helped...

scrappy

0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:appreciative
Comment Utility
OK Scrapdog thanks+++, It'll take me a few minutes (or more) to make the changes...
very, very
Appreciative

You sure are on your toes tonight....!!!  If it works, I'll be in heaven...!!!  Thanks....
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Anything to take a break from studying for SQL exam, math exam, law paper, etc. ETC.  ETC!!!!!!!  (zzzzzz)
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Did it work???


By the way, I noticed that I redeclared total in DisplayTotal.  

void bank::DisplayTotal()
{
  float total = GetTotal();
  cout << total;
}

It would probably be better to do it like this:

void bank::DisplayTotal()
{
  total = GetTotal();
  cout << total;
}


Although the program will run exactly the same way, it is probably better to use total from your class rather than a local variable.  Hopefully you understand why...

(you would probably lose a few points on the assignment for not using total from the bank class!!)
0
 

Author Comment

by:appreciative
Comment Utility
Scrapdog,

Everything works just fine except for the DisplayTotal, whatever I enter it gives me back a total of 1  .....
Would you know what causes this????  I'll review on my side....

Thanks a zillion....
appreciative
0
 

Author Comment

by:appreciative
Comment Utility
Scrapdog, in the meanwhile I'm rejecting Eliezer's answer
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Test it with these values:

1 penny 2 dimes 3 loonies.  (do not enter ANYTHING for nickels or quarters)

What is your output?
0
 

Author Comment

by:appreciative
Comment Utility
Not enough information or explanations....Thank you very much anyway...!!!!
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
If your output is not 3.21, paste all of your source code...
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
>Not enough information or explanations....Thank you very much
>anyway...!!!!

Run the program, and enter 1 for number of pennies, 2 for dimes, etc..

Paste your source code anyway...

0
 

Author Comment

by:appreciative
Comment Utility
Scrapdog, I've been testing and testing, it all works except when I enter nickels, it does not return it in the DisplayTotal nor in the DisplayBreakdown (it gives a 0)...!!

appreciative
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Let's see your source code...
0
 

Author Comment

by:appreciative
Comment Utility
Sorry Scrapdog, its a mess when pasted....but I didn't want to keep you waiting...


//bank.h
class bank  
{
      public:
            bank();
            virtual ~bank();
            void DisplayTotal();
            float GetTotal();
            void AddDimes(int);
            void AddNickels(int);
            void AddPennies(int);
            void AddQuarters(int);
            void AddLoonies(int);
            void DisplayBreakdown();

      private:
            int Loonies, Quarters, Dimes, Nickels, Pennies, userInsert;
            float Total;
};



//bank.cpp
#include <iostream.h>
#include "bank.h"

bank::bank()
{
      Loonies=0, Quarters=0, Dimes=0, Nickels=0, Pennies=0, userInsert=0;
}


bank::~bank()
{

}

void bank::DisplayTotal()
{
      (float) Total=GetTotal();
      cout<<Total;
}

float bank::GetTotal()
{
      return (float)((Dimes*.10)+(Nickels*.05)+(Pennies*.01)+(Quarters*.25)+(Loonies*1));
}

void bank::AddDimes(int userInsert)
{
      if(userInsert>0)
      {
            Dimes=userInsert;
      }
}

void bank::AddNickels(int unserInsert)
{
      if(userInsert>0)
      {
            Nickels=userInsert;
      }
}

void bank::AddPennies(int userInsert)
{
      if(userInsert>0)
      {
            Pennies=userInsert;
      }
}

void bank::AddQuarters(int userInsert)
{
      if(userInsert>0)
      {
            Quarters=userInsert;
      }
}

void bank::AddLoonies(int userInsert)
{
      if(userInsert>0)
      {
            Loonies=userInsert;
      }
}

void bank::DisplayBreakdown()
{
      cout<<"pennies "<<Pennies<<"\n";
      cout<<"nickels "<<Nickels<<"\n";
      cout<<"dimes "<<Dimes<<"\n";
      cout<<"quarters "<<Quarters<<"\n";
      cout<<"loonies "<<Loonies<<"\n";       
}


//bankmain.cpp
#include <iostream.h>
#include "bank.h"

void main (void)
{
      int selection,userInsert;
      bank *transact;
      transact=new bank;

      do
      {
            cout<<"\nPiggy Bank Menu\n\n";
            cout<<"1) Insert Pennies\n";
            cout<<"2) Insert Nickels\n";
            cout<<"3) Insert Dimes\n";
            cout<<"4) Insert Quarters\n";
            cout<<"5) Insert Loonies\n";
            cout<<"6) Display Current Total in Bank\n";
            cout<<"7) Display Coin Breakdown in Bank\n";
            cout<<"0) Quit\n";
            cout<<"\nPlease enter your selection:  ";
            cin>>selection;
      
            switch(selection)
            {
                  case 1:
                        cout<<"\nPlease indicate number of Pennies                                                         inserted:  ";
                        cin>>userInsert;
                        (*transact).AddPennies(userInsert);
                        break;
                  case 2:
                        cout<<"\nPlease indicate number of Nickels                                                         inserted:  ";
                        cin>>userInsert;
                        (*transact).AddNickels(userInsert);
                        break;
                  case 3:
                        cout<<"\nPlease indicate number of Dimes                                                         inserted:  ";
                        cin>>userInsert;
                        (*transact).AddDimes(userInsert);
                        break;
                  case 4:
                        cout<<"\nPlease indicate number of Quarters                                                         inserted:  ";
                        cin>>userInsert;
                        (*transact).AddQuarters(userInsert);
                        break;
                  case 5:
                        cout<<"\nPlease indicate number of Loonies                                                         inserted:  ";
                        cin>>userInsert;
                        (*transact).AddLoonies(userInsert);
                        break;
                  case 6:
                        (*transact).DisplayTotal();
                        break;
                  case 7:
                        (*transact).DisplayBreakdown();
                        break;
                  case 0:
                        cout<<"\nExiting program!\n\n";
                        break;
                  default:
                        cout<<"\nInvalid selection!\n\n";
                        break;
            }
      }while(selection!=0);
}
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
void bank::DisplayTotal()
{
(float) Total=GetTotal();
cout<<Total;
}

You are using (float) as a typecast here.  Remove the (float)
and see if it works.

void bank::DisplayTotal()
{
Total=GetTotal();
cout<<Total;
}



0
 

Author Comment

by:appreciative
Comment Utility
I found it, I made a spelling mistake in void AddNickels(userInsert) I wrote (usenrInsert)....Sorry...I'll test again and I know it will work...back in a flash....
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
btw, there is one more amendment you should make:

void bank::AddDimes(int userInsert)
{
  if(userInsert>0)
  {
    Dimes += userInsert;
  }
}

void bank::AddNickels(int userInsert)
{
  if(userInsert>0)
  {
    Nickels += userInsert;
  }
}

void bank::AddPennies(int userInsert)
{
  if(userInsert>0)
  {
    Pennies += userInsert;
  }
}

void bank::AddQuarters(int userInsert)
{
  if(userInsert>0)
  {
    Quarters += userInsert;
  }
}

void bank::AddLoonies(int userInsert)
{
  if(userInsert>0)
  {
    Loonies += userInsert;
  }
}

All I did here was change the = to += in all of the add functions.  This will add the number of coins rather than set them.  (Looking at Eliezer's answer I think he/she noticed that)...
0
 

Author Comment

by:appreciative
Comment Utility
Yes, it was only a little typing mistake that caused all that nuisance.....
Well....once again, I really don't have words to express my gratitude....!!!
You did it again Scrapdog....Thanks are not enough ....  Again I worked hard on this one, but I'm just starting C++, hope I will eventually get the hang of it....I wasn't that far off  : )

Only one little problem here, how do I transer the point to you????  I rejected the other answer, but now I don't have the dialogue box asking if I accept your answer....!!!!


0
 
LVL 5

Accepted Solution

by:
scrapdog earned 70 total points
Comment Utility
:)
0
 
LVL 5

Expert Comment

by:scrapdog
Comment Utility
Don't hesitate to come back in the future if you need help!!

:)
0
 

Author Comment

by:appreciative
Comment Utility
made the changes, thanks Scrapdog (Scrappy)... now I can go to bed (it's 4:35)....bye...
always,
appreciative
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now