Solved

uh-oh - - need help, lots of help me thinks

Posted on 2001-06-30
7
335 Views
Last Modified: 2008-03-06
ever had that feeling that you have just finished fixing your code and you are about to try and compile it for the last time, and then you see the words "There are errors" and you start to wonder where you can get some prozac from, well i call that saturday, 30 June 2001

If i said that knew exactly how this program works i'd be a liar. im sure i have the genetic disorder that curses me to be a c++ newbie for eternity :(

here are my errors

Compiling MENU2.CPP:
Error MENU2.CPP 152: Cannot convert 'int _ss *' to 'char *' in function Add_A_Car()
Error MENU2.CPP 152: Type mismatch in parameter '__s' in call to 'gets(char *)' in function Add_A_Car()
Error MENU2.CPP 154: Undefined symbol 'Car_Milage' in function Add_A_Car()
Error MENU2.CPP 156: Cannot convert 'int _ss *' to 'char *' in function Add_A_Car()
Error MENU2.CPP 156: Type mismatch in parameter '__s' in call to 'gets(char *)' in function Add_A_Car()
Error MENU2.CPP 158: Could not find a match for 'Order::Order(int,char *,char *,char *,char *,char *,int *,int *,int *)' in function Add_A_Car()
Warning MENU2.CPP 161: 'Car_Price' is declared but never used in function Add_A_Car()
Warning MENU2.CPP 161: 'Car_Mileage' is declared but never used in function Add_A_Car()
Warning MENU2.CPP 161: 'Car_Age' is declared but never used in function Add_A_Car()
Error MENU2.CPP 194: Undefined symbol 'Car_Milage' in function Change_Car_Details_By_Reg()
Error MENU2.CPP 198: Could not find a match for 'Order::Order(int,char *,char *,char *,char *,char *,char *,char *)' in function Change_Car_Details_By_Reg()
Warning MENU2.CPP 199: 'Car_Mileage' is declared but never used in function Change_Car_Details_By_Reg()
Error MENU2.CPP 234: Undefined symbol 'Car_Milage' in function Change_Car_Details_By_ID_Num()
Error MENU2.CPP 238: Could not find a match for 'Order::Order(char *,char *,char *,char *,char *,char *,char *,char *)' in function Change_Car_Details_By_ID_Num()
Warning MENU2.CPP 239: 'Car_Mileage' is declared but never used in function Change_Car_Details_By_ID_Num()
Error MENU2.CPP 248: Cannot convert 'char *' to 'int' in function Remove_Car_By_Reg()
Error MENU2.CPP 258: Cannot convert 'char *' to 'int' in function Remove_Car_By_Reg()
Error MENU2.CPP 258: Type mismatch in parameter 'index' in call to 'Linklist::Delete_Link(int)' in function Remove_Car_By_Reg()
Error MENU2.CPP 259: Cannot convert 'char *' to 'int' in function Remove_Car_By_Reg()
Error MENU2.CPP 260: Cannot convert 'char *' to 'int' in function Remove_Car_By_Reg()
Error MENU2.CPP 299: Cannot convert 'char *' to 'int' in function Show_Car_By_Reg()
Error MENU2.CPP 307: Cannot convert 'char *' to 'int' in function Show_Car_By_Reg()
Error MENU2.CPP 307: 'View_Car' is not a member of 'Order' in function Show_Car_By_Reg()
Error MENU2.CPP 326: 'View_Car' is not a member of 'Order' in function Show_Car_By_ID()


heres the code







the header file "linklist.h"

// the class ORDER to be stored as a linked list
//##############################################
class Order
{
  private :
    char Name[20];
       int OrderID;
       float Price;
       int numordered;
       float totalprice;
       int ID_Num;
                  char Reg_Num[7];
                  char Car_Brand[25];
         char Car_Model[25];
                  char Car_Sub_Model[50];
                  char Car_Colour[25];
                  float Car_Age[5];
                  int Car_Mileage[20];
       float Car_Price;
  public:
       Order();
       Order(char *nme, int num, float cost, int orderno);
       Order(Order* Odr);
       void Display_Order();
       void save_order();
       char *GetName() {return(Name);};
       int GetOrderID() {return(OrderID);};
       float GetPrice() {return(Price);};

}; //end Order def

// the class LINK defining an individual link in the list
//#######################################################

class Link
{
 private:
      Order *Orderptr;
 public:
      Link *next;
      Link();
      Link(Order* An_Order, Link* nextlink);
      ~Link();
      void Display_Link();
      Order *GetOrder(){return Orderptr;};
};  // end link def

// the class LINKLIST defining the actual linklist itself
//#######################################################

class Linklist
{
  private:
       Link *start, *end;
  public:
       Linklist();
       void Add_Link(Order *Odr);
       void Delete_Link(int index);
       int Find_Link(int ref);
       void Display_Link(int ref);
       void Display_List();
       ~Linklist();
}; // end linklist def













and then theres "linklis2.cpp

#include <stdio.h>
#include <iostream.h>
#include <string.h>
#include <fstream.h>
#include <conio.h>
#include <values.h>
#include <ctype.h>
#include <io.h>
#include <process.h>
#include <fstream.h>
#include "linklist.h"

Order::Order()
{
  ID_Num =0;
  Reg_Num[7] = '\0';
  Car_Brand[25] = '\0';
  Car_Model[25] = '\0';
  Car_Sub_Model[50] = '\0';
  Car_Colour[25] = '\0';
  Car_Age[5] ='\0';
  Car_Mileage[20] ='\0';
  Car_Price[10] ='\0';
}

Order::Order(int ID_Num_Passed_Thru, char Reg_Num_Passed_Thru, char Brand_Passed_Thru, char Car_Model_Passed_Thru, char Car_Sub_Model_Passed_Thru, char Car_Colour_Passed_Thru, int Car_Age_Passed_Thru, int Car_Milage_Passed_Thru, float Car_Price_Passed_Thru);

{
  ID_Num = ID_Num_Passed_Thru;
  strcpy(Reg_Num,Reg_Num_Passed_Thru);
  strcpy(Car_Brand,Car_Brand_Passed_Thru);
  strcpy(Car_Model,Car_Model_Passed_Thru);
  strcpy(Car_Sub_Model,Car_Sub_Model_Passed_Thru);
  strcpy(Car_Colour,Car_Colour_Passed_Thru);
  strcpy(Car_Age,Car_Age_Passed_Thru);
  strcpy(Car_Milage,Car_Milage_Passed_Thru);
  strcpy(Car_Price,Car_Price_Passed_Thru);
}

Order::Order(Order *Odr)

{
  ID_Num = Odr-> ID_Num_Passed_Thru;
  strcpy(Reg_Num,Odr->Reg_Num_Passed_Thru);
  strcpy(Car_Brand,Odr->Car_Brand_Passed_Thru);
  strcpy(Car_Model,Odr->Car_Model_Passed_Thru);
  strcpy(Car_Sub_Model,Odr->Car_Sub_Model_Passed_Thru);
  strcpy(Car_Colour,Odr->Car_Colour_Passed_Thru);
  strcpy(Car_Age,Odr->Car_Age_Passed_Thru);
  strcpy(Car_Milage,Odr->Car_Milage_Passed_Thru);
  strcpy(Car_Price,Odr->Car_Price_Passed_Thru);
}

void Order::View_Car()

{ char output[70];
 
cout <<"ID Number           - "<<ID_Num_Passed_Thru                <<"\n";
cout <<"Registration Number - "<<Reg_Num_Passed_Thru             <<"\n";
cout <<"Car Brand           - "<<Car_Brand_Passed_Thru         <<"\n";
cout <<"Car Model           - "<<Car_Model_Passed_Thru            <<"\n";
cout <<"Car Sub Model       - "<<Car_Sub_Model_Passed_Thru      <<"\n";
cout <<"Car Colour          - "<<Car_Colour_Passed_Thru          <<"\n";
cout <<"Car Age             - "<<Car_Age_Passed_Thru            <<"\n";
cout <<"Car Price           - "<<Car_Price_Passed_Thru          <<"\n";
}

void Order::Save_Inv(){
int error;
fstream fs;
fs.open("g:\\order.dat",ios::out);
error=fs.good();
if(error==0){
      cout <<"Error opening file";
      }
      else{

       fs <<"ID Number           - "<<ID_Num_Passed_Thru;
       fs <<"Registration Number - "<<Reg_Num_Passed_Thru;
         fs <<"Car Brand           - "<<Car_Brand_Passed_Thru;
       fs <<"Car Model           - "<<Car_Model_Passed_Thru;
       fs <<"Car Sub Model       - "<<Car_Sub_Model_Passed_Thru;
       fs <<"Car Colour          - "<<Car_Colour_Passed_Thru;
       fs <<"Car Age             - "<<Car_Age_Passed_Thru;
       fs <<"Car Price           - "<<Car_Price_Passed_Thru; <<"\n";
       }
   fs.close();

}


Link::Link()
{
  Orderptr = NULL;
  next = NULL;
}

Link::Link(Order* An_Order, Link* nextlink)

{
  next = nextlink;
  Orderptr = new Order(An_Order);
}


void Link::Display_Link()

{
  cout << "\nLink:";
  Orderptr->Display_Order();
}


Link::~Link()

{
  if (Orderptr != NULL)
       delete Orderptr;
}

//#######################################################


Linklist::Linklist()
{
 start = NULL;
 end = NULL;
}

void Linklist::Add_Link(Order *Odr)
{
  if (start == NULL) {
       start = new Link(Odr, NULL);  
       end = start;              
  }
  else {
       end->next = new Link(Odr, NULL);  
       end = end->next;                  
}


void Linklist::Display_List()
{
  Link *temp;

  cout << "\n Display Linked List";

  if (start != NULL) {  
       temp = start;
       while (temp != NULL) {  
            temp->Display_Link();
            temp= temp->next;       
       }
  }
  else
       cout << "\n List has no members ";
}


void Linklist::Delete_Link(int index)
{
  Link *temp=NULL, *temp2=NULL;
  int i=0;

  if (start == NULL)  
       cout << "\n Error cannot delete link no items in list";
  else {
       temp = start;
       while (temp != NULL) {  
            if (i == (index-1)) {
      if(index == 1) {
        start = temp->next;
        delete temp;           
                   return;
              }
      else {
        temp2->next = temp->next;
        delete temp;         
                   return;
              }
            }
            else {
              i++;
              temp2 = temp;         
      temp = temp->next;  
            }
       }
  cout << "\nError end of list reached, no item of that number present";
  }
}


int Linklist::Find_Link(int ref)
{
  Link *temp=NULL;
  int i=0;

  if (start == NULL)  
       cout << "\n there are no items in list";
  else {
    temp = start;  
    while (temp != NULL) {
      if (ref == (temp->GetOrder()->GetOrderID())) {
          return(i+1);
          }
      else {
        i++;
        temp = temp->next;
      }
    }
 
  cout << "\n Error cannot find item";
  }
}

void Linklist::Display_Link(int ref)
{

  Link *temp=NULL;
  int i=0;

  if (start == NULL)  
       cout << "\n there are no items in list";
  else {
    temp = start;  
    while (temp != NULL) {  
      if (ref == (temp->GetOrder()->GetOrderID())) {
          temp->Display_Link();
          return;
          }
      else {
        i++;
        temp = temp->next;
      }
    }
  cout << "\n Error cannot find item";
  }
}


Linklist::~Linklist()
{
  Link *temp, *temp2;

  if (start != NULL) {  
       temp = start;
       while (temp != NULL) {
            temp2= temp->next;
            delete temp;        
            temp= temp2->next;  
       }
  }

       cout << "\n Linked List Deleted";
}












and then theres the menu file "menu2.cpp"

#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <values.h>
#include <ctype.h>
#include <string.h>
#include <io.h>
#include <process.h>
#include <fstream.h>
#include "linklist.h"

Linklist OrderList;
Order* Orders[5];

      void Add_A_Car();
      void Change_Car_Details_By_Reg();
      void Change_Car_Details_By_ID_Num();
      void Remove_Car_By_Reg();
      void Remove_Car_By_ID();
      void Show_All_Cars();
      void Reg_Plate_Get_ID();
      void ID_Get_Reg_Plate();
      void Car_Search();
      void Save_To_File_By_Reg();
      void Save_To_File_By_ID();

void main()
{
 char choice;
 do
  {
    clrscr();
    cout <<"\n\t\t\tWelcome To The Mercedes-Benz Experiencen Centre Computer System";
    cout <<"\n\t\tPlease Select The Appropriate Option From Below:";
    cout <<"\n # 1.  # Add A Car To The For Sale List";
    cout <<"\n # 2.  # Change Details Of A Car For Sale";
    cout <<"\n # 3.  # Remove A Car From The For Sale List";
    cout <<"\n # 4.  # Show Car Details by Registration Number";
                     //cout <<"\n # 5.  # Show Car Details by ID Number";
    cout <<"\n # 5.  # Get Registration Or ID Number";
    cout <<"\n # 6.  # Search For Specific Models";
    cout <<"\n # 7.  # Save Car Details To File By Registration";
    cout <<"\n # 8.  # Save Car Details To File By ID";
    cout <<"\n # 9.  # End Session";
    cout <<"\n\nMake Your Selection Now : ";
    cin >>choice;
    if (choice=='1')
      {
         Add_A_Car();
      }
    if (choice=='2')
      {
         char choice2=' ';
         cout <<"\n      Make Your Selection";
         cout <<"\n #1.# Change Car Details By Registration Plate";
         cout <<"\n #2.# Change Car Details By ID Number";
         cout <<"\n\n    Here:";
         cin >>choice2;
         if (choice2=='1')
           {
             Change_Car_Details_By_Reg();
           }
      if (choice2=='2')
        {
             Change_Car_Details_By_ID_Num();
        }
      }
    if (choice=='3')
      {
        char choice2=' ';
     cout <<"\n      Make Your Selection";
     cout <<"\n #1.# Remove Car By Registration Plate";
        cout <<"\n #2.# Remove Car By ID Number";
        cout <<"\n\n    Here:";
        cin >>choice2;
        if (choice2=='1')
       {
            Remove_Car_By_Reg();
          }
     if (choice2=='2')
       {
            Remove_Car_By_ID();
       }
      }
    if (choice=='4')
      {
            Reg_Plate_Get_ID();
      }
   if (choice=='5')
     {
             char choice2=' ';
             cout <<"\n               Make Your Selection";
             cout <<"\n #1.# Use Registration Plate To Get ID Number";
             cout <<"\n #2.# Use ID Number To Get Registration Plate";
             cout <<"\n      Here:";
             cin >>choice2;
             if (choice2=='1')
         {
                 Reg_Plate_Get_ID();
         }
          if (choice2=='2')
         {
                 ID_Get_Reg_Plate();
         }
     }
   if (choice=='6')
     {
       Car_Search();
     }
   if (choice=='7')
     {
       Save_To_File_By_Reg();
        }
      if (choice=='8')
        {
                        Save_To_File_By_ID();
        }
      getch();
 } while(choice!='9');
 cout <<"Ending Session......";
 getch();
}

void Add_A_Car()
{

        static int ID_Num =0;
        char Reg_Num[7];
        char Car_Brand[25];
        char Car_Model[25];
        char Car_Sub_Model[50];
        char Car_Colour[25];
        int Car_Age[5];
        int Car_Mileage[20];
        int Car_Price[10];


                  cout <<"\t\t\t\nAdding car to the system....";
                  cout <<"\nID Number :";
                  cin >>ID_Num;
                  cout <<"\nViechle Registration Number :";
                  gets (Reg_Num);
                  cout <<"\nCar Brand :";
                  gets (Car_Brand);
                  cout <<"\nCar Model :";
                  gets (Car_Model);
                  cout <<"\nCar Sub Model :";
                  gets (Car_Sub_Model);
                  cout <<"\nCar Colour :";
                  gets (Car_Colour);
                  cout <<"\nCar Age :";
                  gets (Car_Age);
                  cout <<"\nCar Milage :";
                  gets (Car_Milage);
                  cout <<"\nCar Price :";
                  gets (Car_Price);
                  cout <<"\nThank you.";
                  Orders[ID_Num] = new Order(ID_Num,Reg_Num,Car_Brand,Car_Model,Car_Sub_Model,Car_Colour,Car_Age,Car_Mileage,Car_Price);
                  ID_Num++;

}

void Change_Car_Details_By_Reg()
{

char Reg_Num[7];

                  cout <<"Enter the Registration number :";
                  cin >>Reg_Num;

        static int ID_Num =0;
        char Car_Brand[25];
        char Car_Model[25];
        char Car_Sub_Model[50];
        char Car_Colour[25];
        char Car_Age[5];
        char Car_Mileage[20];
        char Car_Price[10];

                          cout <<"\t\t\t\nEditing Car details....";
                  cout <<"\nID Number :";
                  cin >>ID_Num;
                  cout <<"\nCar Brand :";
                  gets (Car_Brand);
                  cout <<"\nCar Model :";
                  gets (Car_Model);
                  cout <<"\nCar Sub Model :";
                  gets (Car_Sub_Model);
                  cout <<"\nCar Colour :";
                  gets (Car_Colour);
                  cout <<"\nCar Age :";
                  gets (Car_Age);
                  cout <<"\nCar Milage :";
                  gets (Car_Milage);
                  cout <<"\nCar Price :";
                  gets (Car_Price);
                  cout <<"\nThank you.";
                  Orders[ID_Num] = new Order(ID_Num,Car_Brand,Car_Model,Car_Sub_Model,Car_Colour,Car_Age,Car_Mileage,Car_Price);
}

void Change_Car_Details_By_ID_Num()
{

static int ID_Num =0;

                  cout <<"Enter the ID number :";
                  cin >>ID_Num;

        char Reg_Num[7];
        char Car_Brand[25];
        char Car_Model[25];
        char Car_Sub_Model[50];
        char Car_Colour[25];
        char Car_Age[5];
         char Car_Mileage[20];
        char Car_Price[10];



                          cout <<"\t\t\t\nAdding car to the system....";
                  cout <<"\nRegistration Number :";
                  gets (Reg_Num);
                  cout <<"\nCar Brand :";
                  gets (Car_Brand);
                  cout <<"\nCar Model :";
                  gets (Car_Model);
                  cout <<"\nCar Sub Model :";
                  gets (Car_Sub_Model);
                  cout <<"\nCar Colour :";
                  gets (Car_Colour);
                  cout <<"\nCar Age :";
                  gets (Car_Age);
                  cout <<"\nCar Milage :";
                  gets (Car_Milage);
                  cout <<"\nCar Price :";
                  gets (Car_Price);
                  cout <<"\nThank you.";
                  Orders[ID_Num] = new Order(Reg_Num,Car_Brand,Car_Model,Car_Sub_Model,Car_Colour,Car_Age,Car_Mileage,Car_Price);
}

void Remove_Car_By_Reg()
{
char Reg_Num[7];

            cout <<"\nEnter Registration number of the car you wish to remove: ";
            cin >>Reg_Num;

                  if (Orders[Reg_Num]  == NULL)
{

                              cout<<"\nRegistration number not found";
                              getch();
                              return;
}
else
{

            OrderList.Delete_Link(Reg_Num);
            delete (Orders[Reg_Num]);
            Orders[Reg_Num] = NULL;
}
}

void Remove_Car_By_ID()
{
static int ID_Num =0;

            cout <<"\nEnter the ID number of the car you wish to remove: ";
            cin >>ID_Num;

                  if (Orders[ID_Num]  == NULL)
{

                              cout<<"\nRegistration number not found";
                              getch();
                              return;
}
else
{

            OrderList.Delete_Link(ID_Num);
            delete (Orders[ID_Num]);
            Orders[ID_Num] = NULL;
}
}

/*
void Show_All_Cars()

HELP NEED CODE HERE,HELP NEED CODE HERE,HELP NEED CODE HERE,HELP NEED CODE HERE,
*/

void Show_Car_By_Reg()
{
char Reg_Num[7];
            cout <<"\nEnter Registration number of the car you wish to remove: ";
            cin >>Reg_Num;

                        if (Orders[Reg_Num]  == NULL)
{

                                    cout<<"\nRegistration not found";
                                    return;
}
else
{
      Orders[Reg_Num]->View_Car();
}
getch();
}

void Show_Car_By_ID()
{
static int ID_Num =0;
            cout <<"\nEnter Registration number of the car you wish to remove: ";
            cin >>ID_Num;

                        if (Orders[ID_Num]  == NULL)
{

                                    cout<<"\nCar ID not found";
                                    return;
}
else
{
      Orders[ID_Num]->View_Car();
}
getch();
}















/*

void Reg_Plate_Get_ID()   NEED CODE NEED CODE
{

void ID_Get_Reg_Plate()  NEED CODE NEED CODE
{

void Car_Search()       NEED CODE NEED CODE
{

*/








void Save_To_File_By_Reg()
{
char Reg_Num;

            cout <<"\nEnter The Registration Number Of The Car You Wish to Save : ";
            cin >>Reg_Num;
            cout <<"\n";
            Orders[Reg_Num]->save_order();
}

void Save_To_File_By_ID()
{
static int ID_Num =0;

            cout <<"\nEnter The ID Number Of The Car You Wish to Save : ";
            cin >>ID_Num;
            cout <<"\n";
            Orders[ID_Num]->save_order();
}


0
Comment
Question by:pengwinzz
  • 5
7 Comments
 
LVL 22

Expert Comment

by:nietod
Comment Utility
If you are trying to confuse yourself, you are succeeding!   This code is incomprehesible.  You use the same name for different types of things and then don't know you mean by any paritcular name.  

so for example,

In the Order class you call a float "car_price"   Later on in Add_A_Car() you use the same name for an array of ints.  then in Add_a_Car() you try to treat the array of ints car_price as if it is an array of characters by doing a gets(), then in Change_Car_details_By_reg you declare it as an array of character and treat it as such.  But then you pass it to the order() constructor that doesn't take an array of character.    its a mess.  

Its hard to image how to fix it because its hard to know what you even intend to do.

But you need to give things very clear names that make clear what the purpose of the data is and what type of data it is.  "car price" sounds like a single number, like a float.   it doesn't sound like a string.  it doesn't sound like an array of numbers.  That might be "car prices", but not "car price"
0
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
Comment Utility
Here is the part of the order class that defines your data mebers.

class Order
{
 private :
   char Name[20];
      int OrderID;
      float Price;
      int numordered;
      float totalprice;
      int ID_Num;
               char Reg_Num[7];
               char Car_Brand[25];
        char Car_Model[25];
               char Car_Sub_Model[50];
               char Car_Colour[25];
               float Car_Age[5];
               int Car_Mileage[20];
      float Car_Price;
}; //end Order def


now here is one constructor for the class with some problems listed.

Order::Order()
{
 ID_Num =0;
 Reg_Num[7] = '\0'; // Reg_Num is an aray of 7 characters.  These are numbered 0 through 6.  So
                             // Reg_Num[7] is invalid.
 Car_Brand[25] = '\0'; // Invalid index here too.
 Car_Model[25] = '\0'; // here too.
 Car_Sub_Model[50] = '\0'; // here too.
 Car_Colour[25] = '\0'; // here too.
 Car_Age[5] ='\0';  // here to
 Car_Mileage[20] ='\0'; // here too.
 Car_Price[10] ='\0';  // Car_price is not an array.  You can't use an index operator on it
                                // Do you just want to set it to 0?
}

continues
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
next you have a constructor defined for the order class like

Order::Order(int ID_Num_Passed_Thru, char Reg_Num_Passed_Thru, char Brand_Passed_Thru, char
Car_Model_Passed_Thru,
char Car_Sub_Model_Passed_Thru, char Car_Colour_Passed_Thru, int Car_Age_Passed_Thru, int
Car_Milage_Passed_Thru,
float Car_Price_Passed_Thru);

however this constructor is not declared in the class definition.  You have to declare it in the class.

The code for this constructor performs

 strcpy(Reg_Num,Reg_Num_Passed_Thru);
 strcpy(Car_Brand,Car_Brand_Passed_Thru);
 strcpy(Car_Model,Car_Model_Passed_Thru);
 strcpy(Car_Sub_Model,Car_Sub_Model_Passed_Thru);
 strcpy(Car_Colour,Car_Colour_Passed_Thru);
 strcpy(Car_Age,Car_Age_Passed_Thru);
 strcpy(Car_Milage,Car_Milage_Passed_Thru);
 strcpy(Car_Price,Car_Price_Passed_Thru);

as if all those variables are strings.  But they are not.All of the XXXXX_passed_thru varaibles are single characters, not arrays of characters.  i.e they are not strings, they are just one character.    Furthermore Car_price is not even supposed to be a string.  it is supposed to be a number, a float.

continues
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 22

Expert Comment

by:nietod
Comment Utility
Then in the Order constructor that takes an order object as a parameter (via a pointer) you have

   strcpy(Car_Price,Odr->Car_Price_Passed_Thru);

again Car_price is not a string.

Then in

void Order::View_Car()
{ char output[70];

cout <<"ID Number           - "<<ID_Num_Passed_Thru              <<"\n";
cout <<"Registration Number - "<<Reg_Num_Passed_Thru           <<"\n";
cout <<"Car Brand           - "<<Car_Brand_Passed_Thru        <<"\n";
cout <<"Car Model           - "<<Car_Model_Passed_Thru           <<"\n";
cout <<"Car Sub Model       - "<<Car_Sub_Model_Passed_Thru     <<"\n";
cout <<"Car Colour          - "<<Car_Colour_Passed_Thru         <<"\n";
cout <<"Car Age             - "<<Car_Age_Passed_Thru            <<"\n";
cout <<"Car Price           - "<<Car_Price_Passed_Thru          <<"\n";

}

You have defined "output" but never use it.   You code is printing all these XXXXX_passed_thru variables, but they are not defined.  The names of the class's data mebers don't end in "passed_thru".

in

void Order::Save_Inv(){

you do the same thing.  All the vairalbe names end in pass_thru.


That shoudl be enough for the time being.  Fix those things and look for other stuff liek that.  Just plain try to clean stuff up.   This code is VERY far from being compileable.  That makes your task extremely hard.  You should always make changes in small increments and compile after each change and fix the problems before goign on to the next change.   In keeping with that it would probably be a good idea to commment ouut nearly everything and get the code to compile.  Then slowly add back peices (uncomment them) and get them to compile.  For examle, leave the list stuff commented out and start uncommenting the order cloass, but uncomment it one function at a time and get those functions to work before uncommenting the next.  

This allows you to home in on where the errors occur.
0
 

Expert Comment

by:GuyJohnston
Comment Utility
Homework Eh !
Sorry, can't debug your entire program.
I know however how such a great number of errors
can psyche you out. You have to debug you own program.
This is what I would recommend.

1) Take the errors one at at time, don't let all those
   errors get to you.
2) Check spelling ( ex. Milage mileage )
3) Check data types, ( ex. int, char ) Make sure
   you are not trying to convert one into the other.
4) Don't make a function if your not going to
   use it.

Many of the errors are repeated errors.
Don't design a program in full, then try to debug.
As you make a program, test the individual functions for errors, catching them along the way will stop you from
repeating them as the program developes.

Be very methodical in your design.
C++ can be very hard to learn if your just starting out.
The rewards in the end are well worth the struggle.
   
 

0
 

Author Comment

by:pengwinzz
Comment Utility
i see i have a rather large task ahead of me,
thanks for pointing out the error of my ways m8
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
Post your code when you get more done....
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

763 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

13 Experts available now in Live!

Get 1:1 Help Now