What am I doing wrong?

done
Last edited on
Check your spelling of iostream.
I fixed that now how can I fix this problems.
counter.cpp:34: error: expected unqualified-id before '{' token
counter.cpp:34: error: expected `,' or `;' before '{' token
counter.cpp: In function `int odd_one_to_n(int)':
counter.cpp:43: error: expected primary-expression before "int"
counter.cpp:43: error: expected `;' before "int"
counter.cpp:44: error: `k' undeclared (first use this function)
counter.cpp:44: error: (Each undeclared identifier is reported only once for each function it appears in.)
counter.cpp:44: error: expected `;' before ')' token
counter.cpp: In function `int square_cube(int)':
counter.cpp:81: error: no match for 'operator<' in '(+std::operator<< [with _Traits = std::char_traits<char>](((std::basic_ostream<char, std::char_traits<char> >&)(&std::cout)), ((const char*)" Cube of n = ")))->std::basic_ostream<_CharT, _Traits>::operator<< [with _CharT = char, _Traits = std::char_traits<char>](cube) < std::endl'
counter.cpp: At global scope:
counter.cpp:86: error: expected unqualified-id before '{' token
counter.cpp:86: error: expected `,' or `;' before '{' token
Someone please help me to fix errors?
closed account (3hM2Nwbp)
Holy indentation problems batman!

Check line 56, it looks like you might have an extra '}'.

Also, you have some issues beyond line 77.

1) Line 77, extra '{'
2) Line 80, extra '( )'
3) Line 96, did you mean 'while' instead of 'if'?
Last edited on
How do i change them? Can you type the correct codes please? I want to make sure
It sounds like someone is trying to avoid reading his c++ book and is simply copy/pasting code that they do not understand.

There is no replacement for reading your book... so do it.

Study what each of the lines of the code does... Learn how c++ code is supposed to be structured. The basic compiler errors should be very easy to decipher for anyone that did their homework.

If it was something a bit more complex, like a dynamic array or pointers... I would understand... but this is ridiculous
Last edited on
Idont have book. If youdont help dont comment.
Topic archived. No new replies allowed.