| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- // 3.b: Scan vector / maxtrix
- extern int scanInt();
- extern float scanFloat();
- extern void printInt(int c);
- extern void printFloat(float c);
- void scan_vector(float [m] a)
- {
- for (int i = 0, m) {
- a[i] = scanFloat();
- }
- }
- void scan_matrix(float [m,n] a)
- {
- for (int i = 0, m) {
- for (int j = 0, n) {
- a[i,j] = scanFloat();
- }
- }
- }
- export int main()
- {
- int m = 3;
- int n = 3;
- void do_vector()
- {
- float [m] v;
- scan_vector(v);
- }
- void do_matrix()
- {
- float [m,n] M;
- scan_matrix(M);
- }
- if (n == 1 && m >= 1) {
- do_vector();
- }
- else if (n > 1 && m >= 1) {
- do_matrix();
- }
- return 0;
- }
|