5.4 goto

programming/c++ 2019. 4. 30. 11:41

double x;

tryAgain : // label

cout << "Enter a non-negative number" << endl;

cin >> x;


if(x <0.0)

goto tryAgain; //tryAgain(label)로 돌아가라 


cout << sqrt(x) << endl;


'programming > c++' 카테고리의 다른 글

5.6 do while  (0) 2019.04.30
5.5 반복문 while  (0) 2019.04.30
5.3 switch case  (0) 2019.04.30
5.1 제어 흐름 소개  (0) 2019.04.30
4.10 구조체  (0) 2019.04.29
Posted by 도이(doi)
,