-
大小: 2.82KB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2021-02-21
- 標簽:
資源簡介
C++實戰(zhàn)源碼-輸出二維數(shù)組任一行任一列值(入門級實例105).zip
代碼片段和文件信息
//?Row.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“stdio.h“
#include?
int?main()
{
int?a[3][4]={123456789101112}; //定義數(shù)組
int?*p(*pt)[4]ij; //聲明指針、指針型數(shù)組等變量
printf(“顯示數(shù)組:“);
for(p=a[0];p {
if((p-a[0])%4==0)printf(“\n“); //每行輸出4個元素
printf(“%4d“*p); //輸出數(shù)組元素
}
printf(“\n“);
printf(“請輸入要輸出的位置:?i=?j=?\n?“);
pt=a;
scanf(“i=%dj=%d“&i&j); //輸入元素位置
printf(“a[%d%d]=%d\n“ij*(*(pt+i)+j)); //輸出指定位置的數(shù)組元素
????getch();
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????652??2010-10-20?09:40??Row\Row.cpp
?????文件????????4500??2010-10-20?09:40??Row\Row.dsp
?????文件?????????531??2010-10-20?09:40??Row\Row.dsw
?????文件?????????290??2010-10-20?09:40??Row\StdAfx.cpp
?????文件?????????769??2010-10-20?09:40??Row\StdAfx.h
評論
共有 條評論