C언어8 -> 연산자와 구조체 -> 연산자 : 포인터 변수에 의한 항목 선택 예시 : typedef struct __Point { int xpos; int ypos; }Point; Point& PntAdder(const Point &p1, const Point &p2) { Point *pptr = new Point; pptr->xpos = p1.xpos + p2.xpos; pptr->ypos = p1.ypos + p2.ypos; return *pptr; } 구조체 사용 struct Structure { int a; char b; }; struct Structure fors; fors.a; fors.b; 예를 들면 C 언어에서는 이렇게 사용 할 수 있다. C++에서는 struct Structure fors; 문에서 struct를 생략하.. 2017. 9. 14. c++ 난수 생성 #include #include #include using namespace std; void main() { int rannum; srand((unsigned)time(NULL)); cout 2017. 9. 14. Visual Studio 2015에서 scanf , strcpy 함수 등의 에러 해결 Visual Studio 2010 버전에서는 Scanf 함수를 사용하여도 Warning 정도만 표시되고 컴파일이 된다. 그러나 예를 들어 Visual Studio Express 2015 for desktop 과 같은 2015 버전에서는 컴파일시 오류 메세지가 뜨며 컴파일이 되지 않는다. 이 문제는 다음과 같은 방법으로 해결 할 수 있다. 1. #define _CRT_SECURE_NO_WARNINGS 을 소스코드 맨 윗줄에 적어준다. 2. 프로젝트 탭 선택 - > 프로젝트 속성 선택 - > _CRT_SECURE_NO_WARNINGS 를 입력한다. 2017. 9. 12. 이전 1 2 다음