Untitled

 avatar
unknown
c_cpp
3 years ago
850 B
1
Indexable
#include <iostream>
#include <iomanip>

using namespace std;

#define CCF_ID_NUM 500

typedef struct {
   bool bDummy;
   int items[CCF_ID_NUM];
} INFO_T;

void printInfo(const INFO_T& info) {
    int countID = (CCF_ID_NUM/10)*10;
    int id = 0;
    for (int i = 0; i < countID; i++) {
        for (id = i; id < i + 10; id+=10) {
            cout << setw(8) << info.items[id];
        }
        cout << endl;
    }

    if (countID <  CCF_ID_NUM) {
       for (int id = countID; id < CCF_ID_NUM; id++) {
           cout << setw(8) << info.items[id];
       }
    }
    cout << "END" << endl;
}

void initMyInfo(INFO_T &_info) {
    for (int i = 0; i < CCF_ID_NUM; i++)
        _info.items[i] = i;
}

int main()
{
    INFO_T myTestInfo;
    initMyInfo(myTestInfo);
    printInfo(myTestInfo);

    return 0;
}