mobile wallpaper 1
mobile wallpaper 2
mobile wallpaper 3
mobile wallpaper 4
mobile wallpaper 5
mobile wallpaper 6
81 자
1 분
C++ 대강 짬뽕 복습
2018-09-12

몇가지 배웠던거 짬뽕해서 날림으로 작성해봤다.

뭐 무슨 컵에 뭐 넣고 무슨 컵에 뭐 넣고 출력하는 것인데, 연산까지 넣기엔 이미 졸려버릴 시간이라…나~중에 주말에나 볼만하도록 할 수 있겠다.

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
bool mainSwitch = false;
int cup = 0;
float water = 0.0f;
char cup1_Name[50] = "";
string inputS;
string cup2_Name = "";
cout << "컵을 실행하시겠습니까? (yes or no)";
cin >> inputS;
while (true)
{
if (inputS == "no")
{
cout << "프로그램을 종료합니다." << endl;
break;
}
else if (inputS == "yes")
{
mainSwitch = true;
while (mainSwitch)
{
cout << "첫번째 컵에 무엇을 얼마나 따릅니까? (스페이스바로 입력구분)" << endl;
cin >> cup1_Name >> water;
cout << "두번째 컵에 무엇을 얼마나 따릅니까? (스페이스바로 입력구분)" << endl;
cin >> cup2_Name >> cup;
cout << "각 컵에 들어간 액체의 종류와 g(gram)수" << endl;
cout << cup1_Name << " : " << water << "g" << endl;
cout << cup2_Name << " : " << cup << "g" << endl;
string outi = "";
cout << "프로그램을 종료하려면 yes를 계속하시려면 no를 입력해주세요. ";
cin >> outi;
if (outi == "yes")
{
mainSwitch = false;
inputS = "no";
}
}
}
else
{
cout << "잘못 입력하셨습니다. yes or no 로 대답해주십시오." << endl;
}
}
}
공유하기

이 글이 도움이 되었다면 더 많은 분들께 공유해 주세요!

C++ 대강 짬뽕 복습
https://nirobase.me/posts/180912-cpp-etc-01/
작성자
irostub
게시일
2018-09-12
라이선스
CC BY-NC-SA 4.0

일부 정보가 오래되었을 수 있습니다

목차