#can someone help me with my code

20 messages · Page 1 of 1 (latest)

unkempt tulipBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

broken jewel
#

Can we have the code and the error message please?

slate spoke
#

so i wrote the code on a testing website and it output the thing i need but when i try to turn it in for class it pop a whole bunch of error

stuck sparrow
#

Probably undefined behavior or something. You need to answer what swyde asked for if you want any help at all

slate spoke
#

i cant code the code so i put in a doc

#

these are the error main_tester.cpp:

main_tester.cpp

Error:

In file included from main_tester.cpp:6:
student.h:114:7: error: ‘Date::Date’ has the same name as the class in which it is declared
114 | class Date {
| ^~~~
main_tester.cpp:402:2: error: expected unqualified-id at end of input
402 | }
| ^
main_tester.cpp:402:2: error: expected ‘}’ at end of input
student.h:109:12: note: to match this ‘{’
109 | class Date {
| ^
main_tester.cpp:402:2: error: expected unqualified-id at end of input
402 | }
| ^
In file included from main_test_classes.h:9:
student.h:114:7: error: ‘Date::Date’ has the same name as the class in which it is declared
114 | class Date {
| ^~~~
main_test_classes.h:575:3: error: expected unqualified-id at end of input
575 | };
| ^
main_test_classes.h:575:3: error: expected ‘}’ at end of input
student.h:109:12: note: to match this ‘{’
109 | class Date {
| ^
main_test_classes.h:575:3: error: expected unqualified-id at end of input
575 | };
| ^
student.h:114:7: error: ‘Date::Date’ has the same name as the class in which it is declared
114 | class Date {
| ^~~~
student.h:381:2: error: expected unqualified-id at end of input
381 | }
| ^
student.h:381:2: error: expected ‘}’ at end of input
student.h:109:12: note: to match this ‘{’
109 | class Date {
| ^
student.h:381:2: error: expected unqualified-id at end of input
381 | }

late portal
#

!code

unkempt tulipBOT
#
How to Format Code on Discord
Markup

```c
int main() {}
```

Result
int main() {}
late portal
#

Use this when pasting errors too, so that the discord doesn't break the formatting

#

It tells you what's wrong:

next willow
#
class Date {
public:
    friend class DateTester;

class Date {
private:
    int month;
    int day;
    int year;
    // rest of code

Yeah, that's not valid C++.

You are declaring a class Date nested within class Date.

#

You can legally nest classes with C++, but I seriously doubt you are at that stage already.

late portal
#

Spoilers sadge

next willow
late portal
broken jewel
next willow
#

Is pointing out mistakes something we no longer do on this server?

#

And no, I hadn't missed it.
It was very evident (to me) that this is a student struggling with an assignment.

broken jewel