06/06/29 수업내용

DEVELOP/C 2006. 6. 29. 14:15

준비

입력

처리

출력

%d 숫자
%2d 2칸이상의 숫자


include

void main()
{
int movedDistance=300;
int slugDaySpeed=55;
int slugNightSpeed=13;
int passedDate=0;
int dayCount=0;

cout << movedDistance << "/" << dayCount;
cout << "\n";

while(movedDistance>=0)
{
dayCount=dayCount+1;
if (movedDistance>=0)
{
movedDistance=movedDistance-slugDaySpeed;
}
cout << movedDistance << "/" << dayCount;
cout << "\n";
if (movedDistance>=0)
{
movedDistance=movedDistance-slugNightSpeed;
}
cout << movedDistance << "/" << dayCount;
cout << "\n";
}
}

피보나치수열
#include <iostream.h>
int main()
{
int a=1,b=0,c=0;

while(a<=500)
{
cout << a <<endl;
c=a;
a=a+b;
b=c;
}
return 0;
}

AND