Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why won't this C++ program run? Code Below: //OfficeSupply.h #ifndef GOLDFISH_H #define GOLDFISH_H #include #include using namespace std; class Goldfish { public: Goldfish(); Goldfish (

Why won't this C++ program run?

Code Below:

//OfficeSupply.h

#ifndef GOLDFISH_H

#define GOLDFISH_H

#include

#include

using namespace std;

class Goldfish

{

public:

Goldfish();

Goldfish ( int, char [], double );

int GetInventoryNumber() const;

char* GetGoldfishType () const;

double GetPrice () const;

void Display() const;

private:

int InventoryNumber;

double Price;

mutable char GoldfishType[25];

};

#endif

//Mainform.H

#pragma once

namespace Program2Sample {

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

using namespace System::IO;

using namespace System::Runtime::InteropServices;

private: System::Void Form1_Load(System::Object^ sender,

System::EventArgs^ e)

{

PictureBox->Image=

Image::FromFile(String::Concat(Directory::GetCurrentDirectory(),"\\Splash.jpg"));

}

private: System::Void ExiButton_Click(System::Object^ sender,

System::EventArgs^ e)

{

Application::Exit();

}

private: System::Void NumberInputBox_Click(System::Object^ sender,

System::EventArgs^ e)

{

NumberInputbox->Clear();

TypeInputbox->Clear();

PriceInputbox->Clear();

NumberOutputbox->Clear();

TypeOutputBox->Clear();

PricOutputbox->Clear();

}

private: System::Void DisplayButton_Click(System::Object^ sender, System::EventArgs^ e)

{

int InitInventoryNumber = 0;

char* InitType;

double InitePrice = 0.0;

String^ TypeString;

InitInventoryNumber = Concert::ToInt32(NumberInputBox->Text);

InitType = (char*) (void*)Marshal::StringToHGlobalAnsi(TypeInputBox->Text);

Goldfish InventoryItem(InitInventoryNumber, InitType, InitPrice);

NumberOutputBox->Text = Convert:;ToString(InventoryItem.GetinventoryNumber());

Type String = gcnew String (InventoryItem.GetInventoryNumber());

TypeOutputBox->Text = TypeString;

PriceOutputBox->Text = ( (Decimal) (InventoryItem.GetPrice()) ).ToString("c");

}

}

//Supply.cpp

#include "stdafx.h"

#include "OfficeSupply.h"

Goldfish::Goldfish()

{

InventoryNumber = 0;

GoldfishType[24] = '\0';

Price = 0;

}

Goldfish::Goldfish (int InitInventoryNumber, char InitGoldfishType[], double InitPrice )

{

InitInventoryNumber = InitInventoryNumber;

strcpy_s( GoldfishType, InitGoldfishType );

Price = InitPrice;

int Goldfish::GetInventoryNumber() const

{

return (InventoryNumber);

}

char* Goldfish::GetGoldfishType() const

{

return (GoldfishType);

}

double Goldfish::GetPrice() const

{

return (Price);

}

void Goldfish::Display() const

{

char Separator[50] = "_________________________________________________";

cout

cout

cout

cout

cout

cout

cout

cout

cout

setw(12)

}

//OfficeSupply.cpp

// OfficeSupply.cpp : main project file.

#include "stdafx.h"

#include "MainForm.h"

using namespace Program2Sample;

[STAThreadAttribute]

int main(array<:string> ^args)

{

// Enabling Windows XP visual effects before any controls are created

Application::EnableVisualStyles();

Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it

Application::Run(gcnew Form1());

return 0;

}

//stdafx.cpp

#pragma once

#include "stdafx.h" #include "OfficeSupply.h"

Attached Errors:

image text in transcribed

* 59 Errors | ! 0 warnings 00 Messages Seardh Error List Column Project 1 error C2059: syntax error: private 32 eror C2143: syntax error: missing before'- 3 error C2059: syntax error: private 34 error C2059: syntax error: private 35 error C2055:NumberInputbox': undeclared identifier 36 error C2227: left of Clear must point to dass/struct/urion/generic type 29 7 error C2065: Typelnputbox': undeclared identifier 38 error C2227: left of Clear must point to dass/struct/urion/generic type 39 error C2055: PriceInputbox' : undedared identifer 10 error C2227: left of Clear must point to dlass/jstructjuniongeneric type 11 error C2065:NumberOutputbox': undedared identfier 12 error C2227: left of Clear must point to dlassjstruct/uniongeneric type 13 error C2065: TypeOutputBox: undedared identfier 14 error C2227: left of Clear must point to dass/structjuniongeneric type 15 eror C2065: Pricoutputbox: undedared identfier 16er C2227: left of" >Clear must point to dass structjunion/generic type * 17 error C2059: syntax error : private' 35 18 err C2653 Concert: is not a dass or namespace name 319 error C2065: umberInputsox : undeclared identfier 20 error C2227: left of >Text must point to 321 error C3361: Tont32: identfier not found 322 error C2055:TypeinputBox': undedared identfer 23 error C2227: left of >Text must point to dass/struct/union/generic type 324 errer C2055: Goldfish': undeclared idenbfer 25 error C2146: syntax error missing before identifier Inwentoryltem 26 error C2055: InitPrice': undedared identifier 327 error C3361: InventoryItem: idenifer not found 328 error C2055:NumberOutputBox' : undedered identfier 329 error C2227: left of ->Text must point to dass/struct/union/generic type 3 30 error C2143: syntax error : missing before 31 error C2065: Inventoryltem': undecared identifier 32 error C2228: left of .GetinventoryNumber must have class struct/union 33 eror C3361: ToString: idenbfier not found * 34 error C3522: Systeme :Type: a dass declared aG 'abstract' cannot be nstantated 35 error C2051: syntax error: identfier String 36 error C3767: System::Type::Type: canddate function(s) not accessible 337 error C2055: TypeOutputBox: undedared identifier 38 eror C2227: left of->Text must point to dass/struct/union/generic type 39 error C2055: PriceOutputBox: undedared identifer 40 error C2227: left of >Text must point to dass/struct/union/generic type 52 52 41 error C2055: Inventoryltem: undedared identifier 342 error C2228 left of ".GetPrice must have dass/structlunion 43 error C2228: left of .ToString must have dass/structfunion 344 error C2061: syntax eror : identifier Form 1 345 error C2601: Goldfish::GetinventoryNumber': local function definitions are ilegal OfficeSupply.app Supply.app Supply.app Supply.app Supply.app Supply.app Supply.qpp Supply.app Supply.app upply.cpp 16 46 error C2601: Goldifich::GetGoldfishType': local function definitions are ilegel 347 error C2801: Goldfish::GetPrice: local function definitions are illegal 48 error C2601: Goldfich::Display: local function definitions are legal * 49 error C2059: syntax error : * 50 error C2059: syntax error : * s 1 error C2059: syntax error : 352 error C2059 syntax error:T 25 35 53 error C 1075: end of file found before the left brace .(' at 'Supply.cpp(46), was matched 54 IntellSense: a function type involving a generic parameter cannot have an ellpsis parameter 21 r, 55 Intelsense: functon type involving genenc parameter cannot have an elpas parameter 56 IntellSense: Inkage speofication is incompatble with previous bsearch s (dedared at Ine 426) stdib.h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

What must a person do to apply?

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago