K

@kimjuha19

도형 면적

C++
5 months ago
#include <iostream> using namespace std; class Shape { public: virtual double area() { return 0; } };

은행 계좌

C++
5 months ago
#include <iostream> using namespace std; class Account { protected: double balance; public: Account(double b) { balance = b;

학생 명부

C++
5 months ago
#include <iostream> #include <string> using namespace std; class Student { public: string name; int score; };

두 점 사이의 거리

C++
5 months ago
#include <iostream> #include <cmath> using namespace std; class Point { private: double x, y; public: Point(double xVal, double yVal) {

생성자 오버로딩

C++
5 months ago
#include <iostream> using namespace std; class Circle { private: double radius; public: Circle() { radius = 1;

성적 등급 판별

C++
5 months ago
#include <iostream> using namespace std; class Grade { public: int score; Grade(int s) { score = s;

사각형 넓이와 둘레

C++
5 months ago
#include <iostream> using namespace std; class Rectangle { private: int width; int height; public:

기본 출력 클래스

C++
5 months ago
#include <iostream> #include <string> using namespace std; class Info { private: string name; int age;

도형 상속

Python
5 months ago
class Shape: def __init__(self, circle, triangle): self.circle = circle self.triangle = triangle def circle_area(self): return 3.14 * self.circle * self.circle def triangle_area(self): return (self

카운트다운 게임

Python
5 months ago
class Timer: def __init__(self, time): self.time = time def discount(self): while self.time > 0: self.time -= 1 def __str__(self): return f"Timer(time={self.time})"

학생 정보 클래스

Python
5 months ago
class Student: def __init__(self, name, age, school): self.name = name self.age = age self.school = school def display_info(self): print(f"이름: {self.name}") print(f"나이: {self.age}") print(f"학교

성적 처리

Python
5 months ago
class Score: def __init__(self, korean,math,english): self.korean = korean self.math = math self.english = english def total(self): return self.korean + self.math + self.english def average(se

사각형 계산기

Python
5 months ago
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return 2 * (self.width + self.height)

은행 계좌

Python
5 months ago
class Account: def __init__(self, balance): self.balance = balance def deposit(self,amount): self.amount = amount def withdraw(self,amount): self.balance -= amount if self.balance < 0: prin

팰린드롬 숫자

Python
5 months ago
def is_palindrome_num(n): answer = False ans = 0 total3 = n // 100 * 100 total2 = total3 - (n // 10) total1 = n - total3 - total2 ans = total3 + total2 + total1 return

3진법 뒤집기

Python
5 months ago
def ternary_reverse(n): ternary = "" while n > 0: ternary += str(n % 3) n = n // 3 result = 0 power = 1 i = 0 while i < len(ternary):

콜라츠 추측

Python
5 months ago
def collatz(n): answer = 0 while n > 1: if n % 2 == 0: n = n // 2 answer += 1 elif n % 2 != 0: n = n * 3 + 1 answer += 1 if answer > 500:

예산 분배

Python
5 months ago
def max_departments(d_list, budget): answer = 0 d_list.sort() for i in range(len(d_list)): if budget < d_list[i]: break budget -= d_list[i] answer += 1 return answer

이상한 문자 만들기

Python
5 months ago
def weird_string(s): answer = "" for i in range(len(s)): if i % 2 == 0: up_word = s[i].upper() answer += up_word elif i % 2 != 0: down_word = s[i].lower() answer += down_word

팰린드롬 숫자

Python
5 months ago
def is_palindrome_num(n): if n < 0: return False temp = n rev = 0 while temp > 0: rev = rev * 10 + temp % 10 temp = temp // 10