Skip to content

Instantly share code, notes, and snippets.

@marcosecchi
Last active March 25, 2025 05:49
Show Gist options
  • Save marcosecchi/8bff6ed859cb46e2a87cd13283948e16 to your computer and use it in GitHub Desktop.
Save marcosecchi/8bff6ed859cb46e2a87cd13283948e16 to your computer and use it in GitHub Desktop.
01 - Basi di C++ - Errori di Sintassi

Basi di C++

Task 01 - Errori di Sintassi

Il seguente codice contiene tre errori di sintassi: individuarli e correggerli.

#include<iostream>
using namespace std;
class BaseCharacter
{
string name;
public:
void Attack()
{
cout << name << " is attacking << endl;
}
void Parry()
{
cout << name << " is parrying" << endl;
}
void SetCharacterName(string value)
{
name = value
cout << "Character is named: " << name << endl;
}
};
int main()
{
BaseCharacter Leonatos;
Leonatos.setCharacterName("Leonatos");
Leonatos.Attack();
Leonatos.Parry();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment