제가 하고 싶은 것은 배열에 사용자가 입력한 음식과 kcal을 입력받고 kcal를 다 합치는 건데요,
class Kcal
{
protected:
string food[10];
double inkcal[10];
string sports[10];
double outkcal[10];
public:
void GetInkcal(string food, double inkcal);
void GetOutkcal(string sports, double outkcal);
};
void Kcal::GetInkcal(string food, double inkcal)
{
double insum;
cout<<"당신이 먹은 음식들을 10개 이내로 입력하세요.\n";
for(int f = 0; f<10; f++)
cin>>food[f];
cout<<"음식들의 칼로리를 알맞게 입력하세요.\n";
for(int in = 0; in<10; in++)
cin>>inkcal[in];
insum+=inkcal[in];
}
void Kcal::GetOutkcal(string sports, double outkcal)
{
double outsum;
cout<<"당신이 한 운동들을 10개 이내로 입력하세요.\n";
for(int s = 0; s<10; s++)
cin>>sports[s];
cout<<"운동으로 소모한 칼로리를 입력하세요.\n";
for(int out = 0; out<10; out++)
cin>>outkcal[out];
outsum+=outkcal[out];
}
했더니 에러가 뜨네요..
포인터를 써야 할 것 같은데 어떻게 써야 할 지 모르겠어요....ㅠㅠㅠ
도와주시면 정말 감사하겠습니다!!!!
앞에 있는 ...이 한심하다는 뜻인 줄 알고 괜히 쫄았네요ㅠㅠㅠ
아 맞다, 알려주셔서 감사합니다!!!