아래 point& 를 Point 로 대문자로 해야되는 것 아닌가요?
이거면 에러 없어질 것 같은데.
void move(point& q) {
--*q.x;
++*q.y;
}
>c++ 아시는분에게 도움을 청합니다.
>낼까지 제출해야 하는데 도저히 뭐가 문제인지 모르겠습니다.
>다음 프로그램에서 틀린것은 없는듯 한데 에러가 4개 검출됩니다.
>에러내용은 하단부에 작성해 두었습니다.
>아시는분은 꼭좀 도와주세요. 이 한문제때문에 밤새게 생겼습니다.
>밤새도 디버그 못할꺼 같은데.... 벌써부터 이러니....
>
>#include<iostream>
>using namespace std;
>
>struct Point {
> int *x,*y;
>};
>void move(point& q) {
> --*q.x;
> ++*q.y;
>}
>int main() {
> Point p;
> int a=5,b=-12;
> p.x=&a;
> p.y=&b;
> move(p);
> cout<<"*p.x="<<*p.x<<'\\n';
> cout<<"*p.y="<<*p.y<<'\\n';
> return 0;
>}
>
>--------------------Configuration: 10 - Win32 Debug--------------------
>Compiling...
>10.cpp
>C:\\Program Files\\Microsoft Visual Studio\\MyProjects\\10\\10.cpp(7) : error C2065: 'point' : undeclared identifier
>C:\\Program Files\\Microsoft Visual Studio\\MyProjects\\10\\10.cpp(7) : error C2065: 'q' : undeclared identifier
>C:\\Program Files\\Microsoft Visual Studio\\MyProjects\\10\\10.cpp(7) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
>C:\\Program Files\\Microsoft Visual Studio\\MyProjects\\10\\10.cpp(16) : error C2065: 'move' : undeclared identifier
>Error executing cl.exe.
>
>10.obj - 4 error(s), 0 warning(s)
>
☞ 본 게시판에서 모발이식 수술 후기는 신고 바랍니다. (삭제 및 탈퇴)
댓글