컴퓨터 공부37 [C++] 간단한 계산기를 만들어 보았다. #간단한 계산기를 만드는 코드 #include using namespace std; int Calculate(int a, int b, char str) { switch (str) { case '+': return a + b; case '-': return a - b; case '*': return a * b; case '/': return a / b; default: return 0; } } int main() { int a = 0; int b = 0; char str = '+'; int result = 0; cout > b; result = Calculate(a, b, str); cout a >> str >> b; result = Calculate(a, b, str); cout 2021. 3. 20. [C++] 무작위로 배열 값 출력해보기 #코드 #include #include #include using namespace std; int main() { srand(time(0)); string item[5] = {"money", "box", "water", "file", " "}; int result = (rand() % 5 ); cout 2021. 3. 17. [C++] 엄청 단순한 신호등 코드를 만들어 보았습니다. #신호등을 만들어본 코드 #include #include using namespace std; int main() { cout 2020. 12. 1. 1-2. 마름모 패턴 피라미드를 만들어보자 #마름모 패턴 피라미드를 만드는 코드 #include using namespace std; int main(){ int i, j, k, a; cout > a; for(i=0; ii; k--) cout 2020. 10. 25. 이전 1 ··· 4 5 6 7 8 9 10 다음 728x90