วันอังคารที่ 21 กรกฎาคม พ.ศ. 2552

การเขียนโปรแกรมแบบ iostream.h กับ stdio.h

นี้เป็น โปรแกรมสำหรับคำนวณ พื้นที่สี่เหลี่ยม ตามที่เรากำหนดโดยเขียนให้ออกมาเป็น 2 รูปแบบคือ


1."stdio.h"

2."iostream.h"


"stdio.h"


#include"stdio.h"
void main()
{

int hight;
int width;
int sum;
printf(",.:'*':. :Parallelogram area calculating progaram: .:'*':. \n\n");
printf("Hight is : ");
scanf ("%d",&hight);
printf("\nWidth is : ");
scanf ("%d",&width);
sum = hight*width;
printf("\nThe Circle Area :%d",sum);

}


"iostream.h"


#include "iostream.h"
void main()
{

float hight;
float width;
float all;
cout << ",.:'*':. :Parallelogram area calculating progaram: .:'*':. \n \n";
cout << "Hight is : ";
cin >> hight;
cout << "\nWidth is : ";
cin >> width;
all = hight*width;
cout <<"\nThe Circle Area :";
cout << all;

}

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

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