Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

home / study / engineering / computer science / questions and answers / topic: computer science (college intro) | c++ programming... Your question has been

home / study / engineering / computer science / questions and answers / topic: computer science (college intro) | c++ programming... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Topic: Computer Science (College Intro) | C++ Prog... Topic: Computer Science (College Intro) | C++ Programming Here is my code and whenever i hover over the first line #include "product.h" it says cannot open source file product.h why is this happening and what is the solution? I am using visual studio 2012 ultimate. This is c++ programming. This is the error i received when i try to build my output 1>------ Build started: Project: ConsoleApplication21, Configuration: Debug Win32 ------ 1> Source.cpp 1>c:\users\sunena\documents\visual studio 2012\projects\consoleapplication21\consoleapplication21\source.cpp(1): fatal error C1083: Cannot open include file: 'product.h': No such file or directory ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ======== product.h #ifndef _PRODUCT_H #define _PRODUCT_H #include using namespace std; class Product { private: int plu; string productName; int type; double price; double inventory; public: Product(int pl, string pn, int t, double pr, double i); Product(); int getPLU(); string getProductName(); int getType(); double getPrice(); double getInventory(); double updateInventory(double quantity); }; #endif source file product.cpp file #include "product.h" using namespace std; Product::Product() { plu = 0; productName = "none yet"; type = 0; price = 0; inventory = 0; } Product::Product(int pl, string pn, int t, double pr, double i) { plu = pl; productName = pn; type = t; price = pr; inventory = i; } int Product::getPLU() { return plu;} string Product::getProductName() { return productName;} int Product::getType() { return type;} double Product::getPrice() { return price;} double Product::getInventory() { return inventory;} double Product::updateInventory(double quantity) { if (quantity > inventory) cout << "This item is not in stock." << endl; else inventory -= quantity; return inventory; } what am i doing wrong?

It is c++ programming and i am using visual studio 2012 ultimate

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started