| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 티스토리초대
- code 세팅
- Path Alias
- 네이버 클라우드 플랫폼
- 티스토리 초대장/ 티스토리초대
- '티스토리 초대장/ 티스토리초대'
- GitLab Mirroring
- react native #gradle
- GitHub 미러링
- eslint-import-resolver-typescript
- gitlab 연동
- 실행시간 측정
- Emmet
- GitLab미러링
- 음료같은녹즙
- 초대장
- visual studio code cli
- GitHub Mirroring
- visual studio code
- settings sync
- 프레시업 #풀무원 #하루한병 #건강만들기 #풀무원 녹즙
- React Native
- 티스토리 초대장
- currentTimeMillis
- 유니옥션
- code .
- code 설치
- 프리티어
- 니돈내먹
- webstorm
Archives
- Today
- Total
방치하기
홍대 자바 과제calculator -> C# 으로 사칙연산 계산기 인트.파스 가 핵심. 본문
반응형
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Calc
{
public int a, b;
public Calc(int a, int b)
{
this.a = a;
this.b = b;
}
public void option(String opt)
{
if (opt=="+")
{
this.plus();
}
else if (opt=="-")
{
this.minus();
}
else if (opt=="/")
{
this.nanum();
}
else if (opt=="*")
{
this.gob();
}
else
{
}
}
public void plus()
{
System.Console.WriteLine("더한 결과 "+(this.a+this.b));
}
public void minus()
{
System.Console.WriteLine("뺀 결과 "+(this.a - this.b));
}
public void nanum()
{
System.Console.WriteLine("나누기 결과"+ (this.a / this.b));
}
public void gob()
{
System.Console.WriteLine("곱한 결과"+ (this.a * this.b));
}
}
class Calculator
{
public static void Main(String[] args){
System.Console.WriteLine("숫자 1입력 해주세요");
int a = int.Parse(Console.ReadLine());
System.Console.WriteLine("숫자 2입력 해주세요");
int b = int.Parse(Console.ReadLine());
System.Console.WriteLine("연산자를 입력 해주세요");
String c=Console.ReadLine();
Calc jh=new Calc(a,b);
jh.option(c);
}
}
}
반응형
'프로그래밍 > C#' 카테고리의 다른 글
| 홍대 자바 수업 원주 ,넓이 구하는거-C# 생성자 사용 .. (0) | 2009.07.20 |
|---|---|
| 부울형 C# 디비 개념 . 객체 지향 생성자 오버로딩 (0) | 2009.07.20 |
| C# 제어문 . While문 특이해서 역시난 허접해 ㅠ 지금 현재 책본 부분까지 (0) | 2009.07.05 |
Comments