#include <stdio.h>
float hitpoint,mana;
//각 능력치 기본능력치는 5로 세팅,럭키는 랜덤함수를 돌려야하므로 럭키는 0으로 세팅 stpoint라는 스텟포인트
int str=5,cle=5,agi=5,stm=5,lucky,stpoint,chooseSt;
//럭키능력치 0으로 세팅
int luckystr =0,luckycle=0,luckyagi=0,luckystm=0;
//lucky로 통해 얻은 능력치를 sp(스페셜)능력치로 변수 지정
int sphitpoint,spmana,spstr,spagi,spstm,spcle;
//현재 sp능력치와 기본능력치의 합
int nowHp,nowMp,nowStr,nowAgi,nowCle,nowStm;
int main(void){
while(stpoint==5){
printf("스텟을 선택하세요! 1.hp");
scanf("%d",chooseSt);
switch(chooseSt){
case 1:
printf("능력치를 올리셨습니다!");
hp();
break;
}
stpoint--;
}
return 0;
}
//능력치 에서 특별히 30을 찍을수있게해주는 럭키 찬스
int luck(int lucky)
{
lucky=(rand()*10+1);
return lucky;
}
//hp 능력치 1씩 올릴시 20씩 올름 랜덤으로 럭키가 뜬다면 30이올름
int hp (int hitpoint)
{
hitpoint =200;
if(6<=str){
if(7<=lucky){
sphitpoint=luckystr*30;
printf("스페셜 능력치가 되셨군요 ! 체력30이 올랐습니다 !");
}else{
hitpoint=str*20;
printf("HP포인트가 올리셨군요! 체력 20이 올랐습니다!");
}
}
nowHp=sphitpoint+hitpoint;
return nowHp;
}
이래짰는데 스위치로 함수 불러오고싶으요 어찌하면될까여 ?
스위치로짯는대 뭘물어보는거지?
흐음 ... 그렇군 스위치문 케이스1에 hp함수를 불러와서 능력치 올리는걸 하고싶었음
여튼 해보고옴
함수내에는 문제는없지 ?
저 hp홈수