break와 continue 명령문은 프로그램이 코드의 일부를 무시하고 건너뛰게 만든다.
break : switch 명령문과, 모든 종류의 루프에 사용할수 있다.
continue : 루프에만 사용할 수 있다.
break : switch나 루프 바로 뒤에 오는 명령문을 실행하도록 한다.
continue : 루프 몸체의 나머지를 무시하고, 새로운 루프 주기를 시작하게 한다.
#ifndef __Fortune__HomeScene__
#define __Fortune__HomeScene__
#include "cocos2d.h"
class HomeScene:public cocos2d::Scene
{
public:
static cocos2d::Scene* createScene();
};
#endif
#include "HomeScene.h"
#include "HomeLayer.h"
cocos2d::Scene* HomeScene::createScene()
{
auto scene = cocos2d::Scene::create();
auto layer = HomeLayer::createWithScenetype(2);
scene->addChild(layer);
return scene;
}
#include "cocos2d.h"
class HomeLayer:public cocos2d::Layer
{
public:
static cocos2d::Layer* createWithScenetype(int st);
bool init(int st);
private:
int _type;
};
#include "HomeLayer.h"
Layer* HomeLayer::createWithScenetype(int st)
{
auto layer = new HomeLayer();
if (layer && layer->init(st))
{
layer->autorelease();
return layer;
}
return NULL;
}
bool HomeLayer::init(int st)
{
if (!Layer::init())
{
return false;
}
_type = st;
log("scene type : %d", _type);
}
return true;
}
#include <stdio.h>
void sub()
{
printf("sub.c\n");
}
#include <stdio.h>
void sub()
int main()
{
sub();
printf("Hello World!\n");
}
CC=gcc -c
LK=gcc -o
all:hello // 파일 hello가 있으면 종료 없으면 hello: target으로 이동
hello: hello.o sub.o // hello.o, sub.o파일이 있으면 $(LK)명령 실행, 없으면 hello.o: 또는 sub.o: target으로 이동
$(LK) hello hello.o sub.o
hello.o:hello.c
$(CC) hello.c
sub.o:sub.c
$(CC) sub.c
clean:
rm -rf *.o hello // 현재 디렉토리에 .o파일과 hello 제거