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

ฟังก์ชัน < stdio.h > และ < iosteam.h > ในการเขียนสูตรคูณ

แบบใช้ "stdio.h"
#include "stdio.h"
main()
{
int a;
printf("Enter an intiger(0 to stop):");
scanf("%d",&a);
for(int i = 1;i<=12;i++) { printf("%d",a); printf(" X %d\t",i); printf(" = %d\n",a*i); } } แบบใช้ "iosteam.h"
#include "iosteam.h"
void Table (int);
int main ()
{
int a;
cout<<"Enter an intiger(0 to stop):"; cin>>a;
Table (a);
return 0;
}
void Table (int x)
{
for(int i=1;i<=12;i++)
cout<< x << " X " << i << "\t= " << (x*i) << endl;
return ;
}

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

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