의사코드 작성법
1. Start by writing down the purpose of the process.
의사코드가 무엇을 하려는 지 적어준다.
2. Write only one statement per line.
3. IF,ELSE,WHILE 같은 실행식은 대문자로 써야 구분돼 보여진다.
ex)
IF grade is grater than or equal to 60
Print "passed"
ELSE
Print "failed"
4. 요약하지 말고, 코딩을 모르는 사람이 봐도 알 수 있게 작성해야 한다.
ex)
IF input is odd, output "y" (x)
IF user enters ad odd
number, display "y" (o)
5. Pseudocode statements are close to simple English statements
Pseudocode does not typically use variables, but instead describes what the program should do with close-to-real-world objects such as account numbers, names, or transaction amounts.
ex)
IF n1 > n2
PRINT "n1"
IF n1 < n2
PRINT "n2" (x)
IF n1 is greater than n2
PRINT "n1 is greater"
ELSE n2 is greater than n1
PRINT "n2 is greater" (o)
6. Use standard programming structures
만들어내지 말고, 기존 프로그래밍 문법에 있는 거랑 같은 문법을 활용할 것
ex) for, do-while, if, function NAME (), {} 등
7. 짜여진 의사코드 예시
This program will request a greeting from the user. If the greeting matches a specific response, the response will be delivered; if not, a rejection will be delivered.
print greeting
"Hello stranger!"
print prompt
press "Enter" to continue
<user presses "Enter">
print call-to-action
"How are you today?"
display possible responses
"1. Fine."
"2. Great!"
"3. Not good."
print request for input
"Enter the number that best describes you:"
if "1"
print response
"Dandy!"
if "2"
print response
"Fantastic!"
if "3"
print response
"Lighten up, buttercup!"
if input isn't recognized
print response
"You don't follow instructions very well, do you?"
참고사이트 :
https://www.wikihow.com/Write-Pseudocode
How to Write Pseudocode
This wikiHow teaches you how to create a pseudocode document for your computer program. Pseudocode essentially entails creating a non-programming language outline of your code's intent.https://whatis.techtarget.com/definition/pseudocode...
www.wikihow.com
https://ko.wikihow.com/%EC%9D%98%EC%82%AC%EC%BD%94%EB%93%9C-%EC%9E%91%EC%84%B1%EB%B2%95
의사코드 작성법
의사코드(Pseudocode, 슈도코드, 수도코드, 유사코드라고도 불린다)는 알고리즘을 어떻게 짤지 계획할 때 사용되는 비공식적인 도구이다. 머리 속으로 코드 내용을 전부 생각해 낸 후 코드를 작성하는 것은 불가능에 가깝다. 따라서 실제 프로그램 코드를 작성하기 전에, 프로그램의 진행 과정을 단계별로 요약 정리하기 위해 의사코드를 많이 사용한다. 의사코드는 프로그래밍 언어와 인간의 언어가 섞여 있는 형태로 작성되지만, 기술적인...
ko.wikihow.com
'정리하기 이전 자료 ( before 20-11 ) > Algorithm' 카테고리의 다른 글
FloydWarshall 알고리즘 (0) | 2020.05.18 |
---|---|
동적 프로그래밍(Dynamic Programming) (0) | 2020.05.09 |
Stack and Queue (0) | 2020.05.08 |
Kruskal algorithm (0) | 2020.04.24 |
순서도 그리는 법 (0) | 2020.03.17 |
댓글