U E D R , A S I H C RSS

구구단/조재화

데블스캠프 첫쨋날 구구단 코드.

처음 짠 코드
~cpp 
#include<iostream>
using namespace std;
int main()
{
	for(int i=1; i<10 ; i++)
	{
		for(int j=2; j<6; j++)
		{
			cout<<j<<"*"<<i<<"="<<j*i<<"\t";		
		}
		cout<<endl;
		;
	}
	
	cout<<endl;

	for(int d=1; d<10 ; d++)
	{
		for(int k=6; k<10; k++)
		{
			cout<<k<<"*"<<d<<"="<<k*d<<"\t";
		}
		cout<<endl;
	}
	return 0;
}

데블스캠프 세째날


Squeak
  • cho 클래스

~cpp 
Object subclass: #Gugudan
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'cho'
  • printGugudan 메소드

~cpp 
printGugudan
| x y |
x := 2.
y := 1.
8 timesRepeat: [9 timesRepeat: [ Transcript show:x*y; cr. y := y + 1. ]. x := x + 1. y := 1 ].
  • workspace

~cpp 
gugudan := Gugudan new.
gugudan printGugudan.

  • Scheme

~cpp 
(define (inter x y)
  (   when (< x 10)
       (if (= y 10)
           (begin (inter (+ x 1) 1)  )
           (begin (print x)(print *)(print y)(print =)(print (* x y))(newline) (inter x (+ y 1)) )
           )
       )
  )
       
       
       
(inter 2 1)


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:45
Processing time 0.0108 sec