C++의 표준함수 호출
문제1
#include <iostream>
#include <cstring>
using namespace std;
int main(void)
{
char tmp1[10] = "abcde";
char tmp2[10] = "fgha";
cout << strlen(tmp1) << endl;
strcat(tmp1, tmp2);
cout << tmp1 << endl;
strcpy(tmp1, tmp2);
cout << tmp1 << endl;
cout << strcmp(tmp1, tmp2) << endl;
return 0;
}
문제2
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(void)
{
srand(time(NULL));
for (int i = 0; i < 5; i++) {
int x = rand() % 100;
cout << x << endl;
}
return 0;
}
728x90
반응형
'etc. > 열혈 C++ 프로그래밍' 카테고리의 다른 글
(열혈 C++ 프로그래밍) 문제 03-2 (2) | 2021.11.11 |
---|---|
(열혈 C++ 프로그래밍) 문제 03-1 (0) | 2021.11.11 |
(열혈 C++ 프로그래밍) 문제 02-3 (0) | 2021.11.11 |
(열혈 C++ 프로그래밍) 문제 02-2 (0) | 2021.11.11 |
(열혈 C++ 프로그래밍) 문제 02-1 (0) | 2021.11.11 |