Hi all, I am newcomer of C++. I got two tiny nasty C++ code to fix, but I can't fix all the syntax errors. Could anybody fix that for me please?
Thanks in advance!
Codes as below:
Code:
#include <Vector>
using namespace std;
class nasty
{
public:
int x(int h)
{
return h+1;
}
vector<double> v;
int f (rabbit)
{
int *a = new int();
int b = 3;
*a = 3;
int &c = *a;
string s;
nasty blogs = new nasty;
b = blogs.x(3);
}
}
and the other one is:
Code:
#include <string>
class cls
{
public int g(int h)
{
return h+1;
}
}
int f (alice)
{
int *a = new int();
int b = 3;
a = 3;
int &c = *a;
string s = "Hello";
cls cc = new cls();
b = cc.g(3);
}