Visual Studio 2019 Source file error

  • Thread starter Thread starter Sunny2302
  • Start date Start date
S

Sunny2302

Guest
I recently installed Studio 2019 and wrote a simple program to test it. However, I receive a bunch of errors labeled as "cannot open source file xxxxx.h".


The code is:


#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;

class item
{
public:
void setdata(int b, float c);
void showInfo();

private:
int code;
float price;
};

void item::setdata(int a, float b)
{
code = a;
price = b;
}

void item::showInfo()
{
cout << "Code:" << code << endl;
cout << "price:" << price << endl;
}


int main()
{
const int size = 2;
int codeVal;
float cost;
item* ptr1 = new item[size];
item* ptr2 = ptr1;

for (int iter = 0; iter < size; iter++)
{
cout << "Enter code and price for item #" << iter + 1 << endl;
cin >> codeVal; cin >> cost;
ptr1->setdata(codeVal, cost);
ptr1++;
}
}

Continue reading...
 
Back
Top