3.16.2017

3월 16일 실습과제

//원화값 입력받아 달러로 출력하기
#include <iostream>
using namespace std;

int main() {
int i, k;

cout<<"원화값을 입력해주십시오"<<endl;
cin>>i;

double j;

j = i/1150.0;

cout<<j<<"달러"<<endl;

system("pause");
return 0 ;
}

====================================================
//원화값 입력받아 달러와 센트로 출력하기
#include <iostream>
using namespace std;

int main() {
int i, j, k;

cout<<"원화값을 입력해주십시오"<<endl;
cin>>i;


j = i/1150;

cout<<j<<"달러"<<endl;

k = (i%1150)/1150.0 *100;

cout<<k<<"센트"<<endl;

system("pause");
return 0 ;
}

댓글 없음:

댓글 쓰기