검색결과 리스트
paiza에 해당되는 글 86건
- 2023.06.25 Paiza C레벨 086번 문제, 모음 없애기
- 2023.06.24 Paiza D레벨 249번 문제, 주식 거래 손익
- 2023.06.22 Paiza C랭크 84번 문제
- 2020.05.23 C# paiza 80 - 예외처리1
- 2020.05.23 C# paiza 79 - RPG 아이템 일람 재현
- 2020.05.23 C# paiza 78 - 화상이미지 출력
- 2020.05.23 C# paiza 77 - 딕셔너리 루프
- 2020.05.23 C# paiza 76 - 딕셔너리 활용
글
Paiza C레벨 086번 문제, 모음 없애기
using System;
class Program
{
static void Main()
{
// 自分の得意な言語で
// Let's チャレンジ!!
var line = Console.ReadLine();
line = line.Replace("a", "");
line = line.Replace("i", "");
line = line.Replace("u", "");
line = line.Replace("e", "");
line = line.Replace("o", "");
line = line.Replace("A", "");
line = line.Replace("I", "");
line = line.Replace("U", "");
line = line.Replace("E", "");
line = line.Replace("O", "");
Console.WriteLine(line);
}
}
영어 이름을 입력받았을 때 모음을 없앤 내용을 출력하는 문제.
'프로그래밍' 카테고리의 다른 글
Paiza D레벨 249번 문제, 주식 거래 손익 (0) | 2023.06.24 |
---|---|
Paiza C랭크 84번 문제 (0) | 2023.06.22 |
C# 데이터 형 별 크기, 분류 (0) | 2023.05.04 |
프로그래머스 레벨1 C# 덧칠하기(자바) (0) | 2023.04.10 |
프로그래머스 레벨1 C# 옹알이(2) (자바) (0) | 2023.04.08 |
글
Paiza D레벨 249번 문제, 주식 거래 손익
위에 받는 숫자 A가 주식을 매수한 가격이고, 아래에 받는 숫자 B가 매도한 가격이다.
매수한 가격이 매도한 가격보다 높으면 손해니까 No를 출력하게 하고 그 반대는 Yes를 출력하게 한다. A랑 B가 같은 경우는 없다.
using System;
class Program
{
static void Main()
{
// 自分の得意な言語で
// Let's チャレンジ!!
var line = Console.ReadLine();
var line2 = Console.ReadLine();
if(int.Parse(line) > int.Parse(line2))
{
Console.WriteLine("No");
}
else
{
Console.WriteLine("Yes");
}
}
}
'프로그래밍' 카테고리의 다른 글
Paiza C레벨 086번 문제, 모음 없애기 (0) | 2023.06.25 |
---|---|
Paiza C랭크 84번 문제 (0) | 2023.06.22 |
C# 데이터 형 별 크기, 분류 (0) | 2023.05.04 |
프로그래머스 레벨1 C# 덧칠하기(자바) (0) | 2023.04.10 |
프로그래머스 레벨1 C# 옹알이(2) (자바) (0) | 2023.04.08 |
글
Paiza C랭크 84번 문제
using System;
class Program
{
static void Main()
{
// 自分の得意な言語で
// Let's チャレンジ!!
var line = Console.ReadLine();
for(int i = 0;i<line.Length+1;i++)
{
Console.Write("+");
}
Console.WriteLine("+");
Console.WriteLine("+" + line + "+");
for(int i = 0;i<line.Length+2;i++)
{
Console.Write("+");
}
}
}
'프로그래밍' 카테고리의 다른 글
Paiza C레벨 086번 문제, 모음 없애기 (0) | 2023.06.25 |
---|---|
Paiza D레벨 249번 문제, 주식 거래 손익 (0) | 2023.06.24 |
C# 데이터 형 별 크기, 분류 (0) | 2023.05.04 |
프로그래머스 레벨1 C# 덧칠하기(자바) (0) | 2023.04.10 |
프로그래머스 레벨1 C# 옹알이(2) (자바) (0) | 2023.04.08 |
글
C# paiza 80 - 예외처리1
/////////////
//////////
예외처리: 실행시에 발생하는 문제에 대응
메리트: 프로그램을 안정하여 동작하게 하는 시스템의 품질을 높임.
에러 메시지도 읽어서 취할 수 있다.
기술한 소스 코드 > 컴파일러(실행 가능한 형식으로 변환) > 실행한다.(순차, 계산이나 처리를 진행한다)
컴파일 에러 à 綴り의 실수, 문법의 틀림 등.
실행 에러 à 실행 시에 에러: 계산할 수 없다. 파일이 없다 등
예외처리 기능
Try: 미리 코드를 지정하여, 프로그램을 실행했을 때에 처리의 문제를 검출한다.
Catch: 문제를 검출할 때, 어떻게 대응할 지를 기술해 둔다.
Throw: 프로그램 실행 중에 예외가 발생한 것을 통지한다.
예외가 발생하는 예
0으로 나눴을 때, 수치 변환에서 숫자가 아닌 문자를 지정, 배열의 범위 외에 억세스, 파일이 없음.
//////////
////
// 簡単な例外処理をしてみよう
using System;
class Lesson10
{
public static void Main()
{
Console.WriteLine("Hello World");
int number = 2;
//int number =0으로 하면 실행이 되지 않는다.
int answer = 100 / number;
Console.WriteLine(answer);
Console.WriteLine("Hello C#");
}
}
///
/////////
///
///////
// 簡単な例外処理をしてみよう
using System;
class Lesson10
{
public static void Main()
{
Console.WriteLine("Hello World");
try
{
int number = 0;
int answer = 100 / number;
Console.WriteLine(answer);
}
catch(Exception e)
//exception 오브젝트가 메시지로 출력한다.
{
Console.WriteLine(e.Message);
}
//예외처리
finally
{
Console.WriteLine("Hello C#");
}
}
}
//////
'프로그래밍' 카테고리의 다른 글
C# 탭 컨트롤1 (0) | 2020.09.09 |
---|---|
C#에서 탭 컨트롤 넣기 (0) | 2020.09.09 |
C# paiza 79 - RPG 아이템 일람 재현 (0) | 2020.05.23 |
C# paiza 78 - 화상이미지 출력 (0) | 2020.05.23 |
C# paiza 77 - 딕셔너리 루프 (0) | 2020.05.23 |
글
C# paiza 79 - RPG 아이템 일람 재현
////
// RPGのアイテム一覧を再現しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var itemImages = new Dictionary<string, string>();
itemImages.Add("剣", "http://paiza.jp/learning/images/sword.png");
itemImages.Add("盾", "http://paiza.jp/learning/images/shield.png");
itemImages.Add("回復薬", "http://paiza.jp/learning/images/potion.png");
itemImages.Add("クリスタル", "http://paiza.jp/learning/images/crystal.png");
string[] items = {"回復薬", "剣", "盾", "回復薬", "クリスタル", "クリスタル" };
// アイテム名と画像URLを出力する
foreach(var item in items)
{
Console.WriteLine(item);
Console.WriteLine(itemImages[item]);
}
}
}
/////////
/////
////
레슨9 종료
'프로그래밍' 카테고리의 다른 글
C#에서 탭 컨트롤 넣기 (0) | 2020.09.09 |
---|---|
C# paiza 80 - 예외처리1 (0) | 2020.05.23 |
C# paiza 78 - 화상이미지 출력 (0) | 2020.05.23 |
C# paiza 77 - 딕셔너리 루프 (0) | 2020.05.23 |
C# paiza 76 - 딕셔너리 활용 (0) | 2020.05.23 |
글
C# paiza 78 - 화상이미지 출력
////
// RPGのアイテム一覧を再現しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
//화상용 딕셔너리 아이템도
//
var itemImages = new Dictionary<string, string>();
itemImages.Add("剣", "http://paiza.jp/learning/images/sword.png");
itemImages.Add("盾", "http://paiza.jp/learning/images/shield.png");
itemImages.Add("回復薬", "http://paiza.jp/learning/images/potion.png");
itemImages.Add("クリスタル", "http://paiza.jp/learning/images/crystal.png");
string[] items = { "クリスタル", "盾", "剣", "回復薬", "回復薬", "回復薬" };
foreach(var item in items)
{
Console.WriteLine("<img src='" + itemImages[item] + "'>");
Console.WriteLine(item);
Console.WriteLine("<br>");
}
//아이템의 이미지 출력
//아이템 리스트가 출력
}
}
////
//////////////
///////////////화상이미지 출력
//연습1
// RPGのアイテム一覧を再現しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var itemImages = new Dictionary<string, string>();
itemImages.Add("剣", "http://paiza.jp/learning/images/sword.png");
itemImages.Add("盾", "http://paiza.jp/learning/images/shield.png");
itemImages.Add("回復薬", "http://paiza.jp/learning/images/potion.png");
itemImages.Add("クリスタル", "http://paiza.jp/learning/images/crystal.png");
string[] items = { "剣", "盾", "回復薬", "クリスタル" };
// 画像のURLを出力する
foreach (var item in items)
{
Console.WriteLine("<img src'" + itemImages[item] + "'>");
// Console.WriteLine("<br>");
}
}
}
//////////////
'프로그래밍' 카테고리의 다른 글
C# paiza 80 - 예외처리1 (0) | 2020.05.23 |
---|---|
C# paiza 79 - RPG 아이템 일람 재현 (0) | 2020.05.23 |
C# paiza 77 - 딕셔너리 루프 (0) | 2020.05.23 |
C# paiza 76 - 딕셔너리 활용 (0) | 2020.05.23 |
C# paiza 75 - 딕셔너리 조작 (0) | 2020.05.22 |
글
C# paiza 77 - 딕셔너리 루프
//////
// Dictionaryをループで処理しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var enemyDictionary = new Dictionary<string,string>();
enemyDictionary.Add("ザコ","スライム");
enemyDictionary.Add("中ボス", "ドラゴン");
enemyDictionary.Add("ラスボス", "魔王");
Console.WriteLine(enemyDictionary["ザコ"]);
foreach(var enemy in enemyDictionary)
{
Console.WriteLine(enemy.Key + "の" + enemy.Value + "が現れた!");
}
//key와 value가 대입된다.
//key는 자코 중간보소, 라스보스
//value는 뒤에 있는 슬라임, 드래곤, 마왕이 대입된다.
}
}
/////////
////
// Dictionaryをループで処理しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var enemyDictionary = new Dictionary<string, string>();
enemyDictionary.Add("ザコ", "スライム");
enemyDictionary.Add("中ボス", "ドラゴン");
enemyDictionary.Add("ラスボス", "魔王");
// Dictionaryをループで呼び出してください
foreach(var enemy in enemyDictionary)
{
Console.WriteLine(enemy.Key + "の" + enemy.Value + "が現れた");
}
}
}
///////////////
////////
///
// Dictionaryをループで処理しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var members = new Dictionary<string, string>();
members.Add("緑川", "つばめ");
members.Add("六村", "リオ");
members.Add("霧島", "京子");
// Dictionaryをループで呼び出してください
foreach(KeyValuePair<string,string> enemy in members)
{
Console.WriteLine(enemy.Key + "さんの名前は" + enemy.Value + "です");
}
}
}
//////
/////////////////////
1. 아이템의 화상과 아이템의 이름을 표시한다.
2. 같은 아이템을 복수 표시한다.
3. 아이템의 정렬순을 관리한다.
4. 같은 아이템의 화상 파일은 하나를 공유한다.
딕셔너리와 배열을 組み合わせる必要があります。
아이템의 並び順を管理する 배열
나라비쥰에 번호, 아이템명에 아이템의 이름
화상용 딕셔너리 itemImages
Ex) 검이면 > sword.png 파일을 화상 파일로 읽어옴.
방패(盾) > 방해 사진
Items[0] > 크리스탈 itemImages[items[0]] > 크리스탈 사진
이러한 내용을 루프로 처리한다.
/////////////////////////////
'프로그래밍' 카테고리의 다른 글
C# paiza 79 - RPG 아이템 일람 재현 (0) | 2020.05.23 |
---|---|
C# paiza 78 - 화상이미지 출력 (0) | 2020.05.23 |
C# paiza 76 - 딕셔너리 활용 (0) | 2020.05.23 |
C# paiza 75 - 딕셔너리 조작 (0) | 2020.05.22 |
C# paiza 74 - 딕셔너리2 (0) | 2020.05.22 |
글
C# paiza 76 - 딕셔너리 활용
////////////////
/////
// Dictionaryから特定のキーとバリューを削除してよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var enemyDictionary = new Dictionary<String, String>();
enemyDictionary.Add("ザコ", "スライム");
enemyDictionary.Add("中ボス", "ドラゴン");
enemyDictionary.Add("ラスボス", "魔王");
// 「ラスボス」キーのペアを削除
enemyDictionary.Remove("ラスボス");
Console.WriteLine(enemyDictionary.Count);
}
}
////////////
/////////
// Dictionaryをループで処理しよう
using System;
using System.Collections.Generic;
class Lesson09
{
public static void Main()
{
var enemyDictionary = new Dictionary<string,string>();
enemyDictionary.Add("ザコ","スライム");
enemyDictionary.Add("中ボス", "ドラゴン");
enemyDictionary.Add("ラスボス", "魔王");
Console.WriteLine(enemyDictionary["ザコ"]);
foreach(KeyValuePair<string,string> enemy in enemyDictionary)
{
Console.WriteLine(enemy.Key + "の" + enemy.Value + "が現れた!");
}
//key와 value가 대입된다.
//key는 자코 중간보소, 라스보스
//value는 뒤에 있는 슬라임, 드래곤, 마왕이 대입된다.
}
}
///////////////
/////
/////////////
'프로그래밍' 카테고리의 다른 글
C# paiza 78 - 화상이미지 출력 (0) | 2020.05.23 |
---|---|
C# paiza 77 - 딕셔너리 루프 (0) | 2020.05.23 |
C# paiza 75 - 딕셔너리 조작 (0) | 2020.05.22 |
C# paiza 74 - 딕셔너리2 (0) | 2020.05.22 |
C# paiza 73 - 딕셔너리(Dictionary)1 (0) | 2020.05.22 |