int main(int argc, char ** argv){ Triangle Tri(1, 1, 3, 5, 6); Square Sq(1, 2, 5); Circle Cir(1, 3, 2); Sphere Sph(1, 4, 2); Cube Cub(1, 5, 5); Tetrahedron Tetra(1, 6, 10, 10, 10, 10, 10, 10); Cube Cub2(1, 7, 100); Square Sq2(1, 8, 100); Circle Cir2(1, 9, 25); Circle Cir3(1, 10, 45.2); Square Sq3(1, 11, 11.11); Shape * arr; arr = new Shape[11]; arr[0] = Tri; arr[1] = Sq; arr[2] = Cir; arr[3] = Sph; arr[4] = Cub; arr[5] = Tetra; arr[6] = Cub2; arr[7] = Sq2; arr[8] = Cir2; arr[9] = Cir3; arr[10] = Sq3; for(int i = 0; i < 11; ++i){ cout << endl; if(arr[i].getVolume() == -1){ cout << "2-D Shape Found" << endl; cout << "The Shape is: " << arr[i].getName() << endl; cout << "Points are: (" << arr[i].getX() << ", " << arr[i].getY() << ")" << endl; cout << "The Area is: " << arr[i].getArea() << endl; } else{ cout << "3-D Shape Found" << endl; cout << "The Shape is: " << arr[i].getName() << endl; cout << "Points are: (" << arr[i].getX() << ", " << arr[i].getY() << ")" << endl; cout << "The Surface Area is: " << arr[i].getArea() << endl; cout << "The Volume is: " << arr[i].getVolume() << endl; } cout << endl << endl; } delete[] arr; return 0; }
// クラスの初期化時に一度だけ呼ばれる(省略可) void Rule::init() { button_m.show(); title = Font(70); subtitle = Font(40); text = Font(20); mainimage = Texture(L"Asset/Image/ruletext.png"); game1_m = Texture(L"Asset/Image/ScreenShot_Game1.png"); game2_m = Texture(L"Asset/Image/ScreenShot_Game2.png"); game3_m = Texture(L"Asset/Image/Game3Scene.png"); for (int i = 0; i < 40; i++){ cir[i] = Cir(Random(0,Window::Width()),Random(0,Window::Height()), 30, (2 * (i+1))%5+1); } font = Font(20); click = Font(10); SoundAsset(bgm_m).play(); }
int main() { int i; while (scanf("%d%d%d",&n,&m,&q)!=EOF) { memset(count,0,sizeof(count)); makeset(n,m); for (i=1;i<=q;i++) { char name[10]; scanf("%s%d%d",name,&opt[i].x,&opt[i].y); opt[i].s=name[0]; switch (opt[i].s) { case 'C':scanf("%d%d",&opt[i].l,&opt[i].c); break; case 'D':scanf("%d%d",&opt[i].l,&opt[i].c); break; case 'R':scanf("%d%d%d",&opt[i].l,&opt[i].w,&opt[i].c); break; case 'T':scanf("%d%d",&opt[i].w,&opt[i].c); break; } } for (i=q;i>0;i--) { switch (opt[i].s) { case 'C':Cir(opt[i].x,opt[i].y,opt[i].l,opt[i].c); break; case 'D':Dia(opt[i].x,opt[i].y,opt[i].l,opt[i].c); break; case 'R':Rec(opt[i].x,opt[i].y,opt[i].l,opt[i].w,opt[i].c); break; case 'T':Tri(opt[i].x,opt[i].y,opt[i].w,opt[i].c); break; } } for (i=1;i<=9;i++) if (i==9) printf("%d\n",count[i]); else printf("%d ",count[i]); } return 0; }