1 answer

Hi I am using Repl.it, could anyone help fix the errors? Instruction: main.cpp #include <iostream> #include...

Question:

Hi I am using Repl.it, could anyone help fix the errors?

Instruction:

The code I have given you is correct. The problem is that the #include statements are missing. You need to examine the errormain.cpp

#include <iostream>
#include <cstdlib>
#include "InvItem.h"
using namespace std;

int main() {
InvItem a;
string description, idNumber;
  
// read in two strings
getline(cin, description);
getline(cin, idNumber);
  
// store properties in the object
a.setDescription(description);
a.setIDNumber(idNumber);
  
// print out the properties of the object
cout << a.getDescription() << endl;
cout << a.getIDNumber() << endl;
  
}

--------------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------

invltem.h

#ifndef INVITEM_H
#define INVITEM_H
#include<string>
using std::string;

class InvItem
{
public:
InvItem();
void setDescription(string desc);
void setIDNumber(string id);
  
string getDescription() const;
string getIDNumber() const;
private:
string desc;
string id;
};

#endif

-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------

invltem.cpp

#include "InvItem.h"
#include<string>
using std::string;

InvItem::InvItem(): desc(""), id(""){}
void InvItem::setDescription(string desc){
this->desc =desc;
}
void InvItem::setIDNumber(string id){
this->id=id;
}

string InvItem::getDescription() const{return desc;}
string InvItem::getIDNumber() const{return id;}

-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------​​​​​​​-------

Errors:

clang version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final)             exit status 1 invItem.cpp:1:10: fatal error: 'InvItem.h' file not found #include "InvItem.h"          ^~~~~~~~~~~ 1 error generated. main.cpp:3:10: fatal error: 'InvItem.h' file not found #include "InvItem.h"          ^~~~~~~~~~~ 1 error generated.

blue socks - details Failure reason: Error Teachers input: Blue Socks 7265517 Error details: exit status 1 invitem.cpp:1:10:​​​​​​​

The code I have given you is correct. The problem is that the #include statements are missing. You need to examine the error message you get and put the correct #include statements in the files. HINT: If there is an error that some type is not found, and you that type exists, it's a #include error. All three files are missing #include statements.
blue socks - details Failure reason: Error Teacher's input: Blue Socks 7265517 Error details: exit status 1 invitem.cpp:1:10: fatal error: 'InvItem.h' file not found #include "InvItem.h" 1 error generated. main.cpp:3:10: fatal error: 'InvItem.h' file not found #include "InvItem.h"

Answers

Dear student your code is correct but only one small mistake you have made.

Your mistake is the filename in #include statement.

Your header file name is invltem.h but in you code you have written #include "Invltem.h" (the I should be lowercase)

Change your include line to #include "invltem.h" in both files

Please do the above change in include statements and try running your code.

If you face any more errors then let me know in comment section.

-----------------------------------------------------------------------

CODE Screenshots

Files main.cpp ... invitem.cpp 4 L invitem.h main.cpp 1 #include <iostream> 2 #include <cstdlib> 3 #include invItem.h usingFiles invitem.cpp 1 #include invItem.h 2 #include<string> 3 using std::string; main.cpp ... 4 invItem.cpp L invitem.h 5 6 7

Files main.cpp 2 invitem.h 1 #ifndef INVITEM_H #define INVITEM_H #include<string> using std::string; 3 4 invitem.cpp invitem.

-------------------------------------------------------------------------------------------------------------------

OUTPUTFiles E main.cpp ... clang++-7 -pthread -std=c++17 -o main invitem.cpp main.cpp > ./main Blue Socks 7265517 Blue Socks 726551

-------------------------------------------------------------------

Please rate the answer if this helped you,

Thank you

.

Similar Solved Questions

1 answer
A small business owner contributes $4,000 at the end of each quarter to a retirement account that earns 6% compounded qu...
A small business owner contributes $4,000 at the end of each quarter to a retirement account that earns 6% compounded quarterly. (a) How long will it be until the account is worth at least $150,000? (Round your answer UP to the nearest quarter.) _______ quarters (b) Suppose when the account reache...
1 answer
Please use the following account names for this homework: Assets:       Cash         Accounts Receivable         Equipment   &nbsp
Please use the following account names for this homework: Assets:       Cash         Accounts Receivable         Equipment          Vehicles ...
1 answer
Future Income taxes are caused by which of the following? O Accounting errors. The fact that...
Future Income taxes are caused by which of the following? O Accounting errors. The fact that the value of one country's currency relative to that of another can change over time O A company's inability to pay income tax due in a particular tax year. O Differences in IFRS and ITA rules pertai...
1 answer
6. Let g(x) = 2x?(x+2)°(xs)? Write the zeros and their multiplicities. Then choose the end behavior...
6. Let g(x) = 2x?(x+2)°(xs)? Write the zeros and their multiplicities. Then choose the end behavior of the graph: (4 pts) a) up on both sides b) down on both sides c) up on left side; non right d) down on left side, up on right Zero multi down Zero mult! mult: zero end behavior....
1 answer
Affirming the Consequent , Denying the Antecedent , or Undistributed Middle 5. ______ If Orville does...
Affirming the Consequent , Denying the Antecedent , or Undistributed Middle 5. ______ If Orville does not turn his work in on time, he will not pass accounting. Orville passes accounting. He turns his work in on time. 6. _____If Hortense and Algernon work together, they will pass. Hortense and Alger...
1 answer
In a variable volume container, 35 kg of water is heated from 75 °C to 250...
In a variable volume container, 35 kg of water is heated from 75 °C to 250 °C at a constant pressure of 5 bar. a. [4 pts] How much heat was added to the container? b. [8 pts] If the same amount of heat is instead added to 35 kg of water at 75 °C in a rigid container at a constant pressur...
1 answer
A high-speed photograph of a club hitting a golf ball is shown in the figure below
A high-speed photograph of a club hitting a golf ball is shown in the figure below. The club was in contact with a ball, initially at rest, for about 0.0037 s. If the ball has a mass of 55 g and leaves the head of the club with a speed of 2.7 102 ft/s, find the average force exerted on the ball by t...
1 answer
In McDonald’s restaurants with automated kiosks to take orders, the kiosks can take 2 orders per...
In McDonald’s restaurants with automated kiosks to take orders, the kiosks can take 2 orders per minute while employees can take 3 orders per minute. The rental rate on a kiosk is $6 per hour while the average compensation costs for an employee is $18 per hour. Should McDonald’s install ...
1 answer
How is it that the strong and weak nuclear forces do not have an influence beyond the nucleus of the atom?
How is it that the strong and weak nuclear forces do not have an influence beyond the nucleus of the atom?...
1 answer
In 3-6 sentences, and using some of your own words, explain the connection between morality and...
In 3-6 sentences, and using some of your own words, explain the connection between morality and religion. (Base your answer on the module. but you can also offer your own thoughts). T TT Arial 3(12pt) T EIE...
1 answer
Differential Equations 7. Show that the two solutions y, = e" and y, = e' of...
Differential Equations 7. Show that the two solutions y, = e" and y, = e' of y" + 4y' + 3y = 0 are linearly independent. You need not verify that y, and y, are solutions to the DE. Cite any relevant theorem from the text by theorem number and page number....
1 answer
42. What should be the primary change in the following screen? ReadySHARE Vault Setup Installing Please...
42. What should be the primary change in the following screen? ReadySHARE Vault Setup Installing Please iait whle ReadySHARE Vault is being installed Checking for ReadySHARE device NETGEAR 2012 < Back dlose Cancel A. B. C. D. Removing the text after installing. Add time to the progress bar Add th...
1 answer
Base on the subjective data and objective data develop a nursing care plan with a nursing...
Base on the subjective data and objective data develop a nursing care plan with a nursing diagnosis, 1 short term goal, 4 nursing interventions with rationales and an evaluation. Subjective Data: Patient stated, “I was on the Grand Central platform on my way to meet with the prophet of the chu...
2 answers
How do you find dy/dx when #y=ln(tanx)#?
How do you find dy/dx when #y=ln(tanx)#?...
1 answer
Which of the following best describes the role of a staff position in an organization? Multiple...
Which of the following best describes the role of a staff position in an organization? Multiple Choice It is superior in authority to a line position. It relates directly to the carrying out of the basic objectives of the organization. It is supportive in nature, providing service and assistance to ...
1 answer
The atomic radius of FCC aluminum is 0.142 nm. What is the lattice parameter of the...
The atomic radius of FCC aluminum is 0.142 nm. What is the lattice parameter of the unit cell? What is the most densely packed direction and plane in this material? If this was an BCC material, on the cube shown below sketch the most densely packed crystal plane, and state that plane here. Identify ...
1 answer
Show entire mechanism
Show entire mechanism...
1 answer
Consider the RLC circuit shown in the figure. Select 'True', 'False' or 'Cannot telll for the...
Consider the RLC circuit shown in the figure. Select 'True', 'False' or 'Cannot telll for the following statements. True: The current through the inductor always equals the current charging/discharging the capacitor. True: Energy is dissipated in the resistor but not in either th...