Witam, w obiektówce jestem zielony - to dopiero moje początki.
#include <iostream>
#include <string.h>
using namespace std;
class TU
{
public:
string a;
string b;
string get(){return a+b;}
};
int main() {
TU U;
string t1;
string t2;
cin>>t1;
cin>>t2;
U.a=t1;
U.b=t2;
t1=U.get();
cout<<t1<<endl;
if(t1=="KOT")
{
cout<<"PIES"<<endl;
cin.get();
}
}
Taki oto kod generuje mi 3 błędy:
expected ';' before '}' token aa.cpp /aa/src line 18 C/C++ Problem
no match for 'operator=' (operand types are 'std::string {aka std::basic_string<char>}' and 'void') aa.cpp /aa/src line 27 C/C++ Problem
return-statement with a value, in function returning 'void' [-fpermissive] aa.cpp /aa/src line 18 C/C++ Problem
Z czego 2 są w linii 18 co trochę mnie dziwi bo już w linii 19 jest prawie taka sama czynność i o nią nie krzyczy.
Pozdrawiam