Issue in C++ course

I have an issue with one of the lectures in the C++ course.
Here is the link:

C++ Functions Standford Lecture is unavailable.

Did not work for me either, I guess the content has been removed from Youtube.

1 Like

Thank you for the feedback

Hey I dont see where i am wrong, making my constructor inside of my class, but when I run the code, I am getting this messages.

#include <iostream> #inlcude<strings>
using namespace std;

class Person{
        string name;
        int age;
        string gender;
    Person(string n, age a, string g){
            name = n;
            age; a;
            gender = g;
        void printInfo(){
            cout << "The name of the person is " <<name<<endl;
            cout << "The age of the person is " <<age<<endl;
            cout << "The gender of the person is " <<gender<<endl;

int main(){
    //Person jacob = {"Jacob", 37, "Male "};
    Person jacob = Person("Jacob", 37, "Male");
    return 0;

1 Like

am just a student here and I have not even started programming yet so please forgive me if am wrong but looking at the code you have missed spelt include for you string #inlcude on your top line, maybe this is the problem as the errors are referring to your strings.


@Jacob_M Also I think its #include <string> and not #inlcude <strings> so correct the spelling mistake and remove the s from the strings. again am still on Ethereum 101 and not starting any coding yet so could be wrong. another note, maybe it should be string a not age a.

1 Like

Thank you, actually i think the include should be there, I think i just tried to add it, to see if this was the issue, but for sure the wrong spielling would not help it hehe… Enjoy the course my friend.

1 Like

no problem, also not sure if this is correct but looks like you are trying to use a string on a number, shouldn’t it be an interger? maybe something like this.

Person(string n, string g, int a) { name = n; age = a; gender = g; }

1 Like

Hi Jacob

I see 2 issues in your code.

The first issue is that

Should be

Person(string n, int a, string g)

You want the constructor to specify a variable of type integer (int) that you call a as an argument to your constructor.

The second issue that

age; a;

should be

age = a;

Because you are assigning the argument “a” to the internal variable “age”.

Hope this helps!


This would also work, you have switched the order of the arguments in the constructor function but that doesn’t affect the code as long as you use the same order when you are initiating the object later on.


@Ivan The general lecture from MIT at the beginning of the C++ course is talking about Python, not C++. Can this be changed?

1 Like

Hello sir, did you refer to this one?
Optional: Introduction to Computer Science - MIT Lecture

I’m checking it myself, is not exactly about C++, is more about computer science in general. Still if that’s not the lecture, let me know so we can fix it ASAP.

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

Thank you Carlos, yes that is the one I was referring to. I am sure there are similar ones that would be more specific to C++.

1 Like

Indeed sir, but its an optional lecture, just to give you a better understanding on how computers works under the hood before you jump directly into the action of Programming Language (which is more complex if you do not know the basics of computer science). So it’s not a mandatory lecture, just optional.

Still, there are plenty of videos on youtube about c++ that can give you a more deep understanding of it.

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.