วันอังคารที่ 8 กันยายน พ.ศ. 2552

การเปรียบเทียบ"stdio" กับ "iostream.h"

การตรวจสอบสถานภาพของพนักงาน ถ้าอายุการทำงานของพนักงานมากกว่า 20 ปีให้แสดงคำว่า Senior แต่ถ้าไม่ใช่ตามเงื่อนไขแสดง Junior

#include
main()
{
int year;
int work=20;
print f("How many year to work");
scan f("%d", &year);
if(year<=work) printf("Junior"); else printf("senior");
}


#include "iostream.h"
main()
{
int year; int work=20; cout<<"How many year to work?" cin>>year;
if(year<=work)
cout<<"Junior";
else cout<<"senior";
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น