For the following C++ code, identify the 10 errors and rewrite the code using the space provided below.
Do not write a new program just add, remove or change the characters/words that make the code incorrect.
#include "iostream>
using namespace std:
class Line
{
public:
Line( double L ) [ setLength(L); }
void setLength( double L ) { length = L }
double getLength( void ) { return length; }
private=
double length;
};
int main()
{
double len;
cout >> "How long is this line? "
cin >> len;
Line = line(len);
Line *LPtr = line;
cout << "Length of line : " << LPtr.getLength()
<< endl;
}
#include<iostream>
using namespace std;
class Line
{
public:
Line( double L ) { setLength(L); }
void setLength( double L ) { length = L; }
double getLength( void ) { return length; }
private:
double length;
};
int main()
{
double len;
cout << "How long is this line? ";
cin >> len;
Line = line(len);
Line *LPtr = line;
cout << "Length of line : " << LPtr.getLength()
<< endl;
return 0;
}
I change this lines.
#include<iostream>
using namespace std;
Line( double L ) { setLength(L); }
void setLength( double L ) { length = L; }
private:
cout << "How long is this line? ";
return 0;
but their is some error remains.To correct those error i need to know about exactly what is the working of this lines are ?
what is you intention of writing this lines of code.
Line = line(len);
Line *LPtr = line;
For the following C++ code, identify the 10 errors and rewrite the code using the space...