/* 샘플 코드 15 */
#include <iostream>
using namespace std;
int main(){
int i = 0;
while (i < 10) {
cout << i << endl;
i++;
}
}
/* 샘플 코드 16 */
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 10; i++) {
cout << i << " squared is " << i * i << endl;
}
}
/* 샘플 코드 17 */
#include <iostream>
#include <string>
using namespace std;
int main() {
string password;
do {
cout << "Please enter your password :";
cin >> password;
} while (password != "foobar");
cout << "Welcome , you got the password right";
}
/* 샘플 코드 18 */
#include <iostream>
#include <string>
using namespace std;
int main() {
string password;
while (1) {
cout << "Please enter your password :";
cin >> password;
if (password == "foobar") {
break;
}
}
cout << "Welcome , you got the password right";
}
/* 샘플 코드 19 */
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 10; i++) {
cout << "\t" << i;
}
cout << "\n";
for (int i = 0; i < 10; ++i) {
cout << i;
for (int j = 0; j < 10; ++j) {
cout << "\t" << i * j;
}
cout << "\n";
}
}