CS201 Colpmete Idea Solution
Step 1
Copy and paste below given code on Dev C++ compiler
#include <iostream>
#include <cstdlib>
using namespace std;
void DisplayVUID();
void DisplayReverse(char[],int);
void StoreDiagonal();
int main(){
DisplayVUID();
char VUID[12] = {‘B’,’C’,’0′,”1,’2′,’3′,’4,’5′,’6′,’7′,’8′};
DisplayReverse(VUID,11);
StoreDiagonal();
system(“pause”);
}
void DisplayVUID(){
char VUID[12] = “BC012345678”;
cout << “My VUID is: “;
for(int i=0; i<12; i++){
cout << VUID[i];
}
}
void DisplayReverse(char* VUID, int arraysize){
cout << “\nMy VUID in reverse order: “;
for(int i = arraysize – 1; i>=0; i–){
cout << VUID[i];
}
cout << endl;
}
void StoreDiagonal(){
cout << “Digits of my VUID are stored in the diagonal of the digionalMat”
<< endl;
int digionalMat[9][9];
for(int row = 0; row < 9; row++){
for(int col = 0; col < 9; col++){
digionalMat[row][col] = 0;
}
}
digionalMat[0][0]= 1;
digionalMat[1][1]= 2;
digionalMat[2][2]= 0;
digionalMat[3][3]= 4;
digionalMat[4][4]= 0;
digionalMat[5][5]= 3;
digionalMat[6][6]= 4;
digionalMat[7][7]= 5;
digionalMat[8][8]= 6;
for(int row = 0; row < 9; row++){
for(int col = 0; col < 9; col++){
cout << digionalMat[row][col];
cout << ” “;
}
cout << endl;
}
}
Step 2
Make some changes as your desires
Step 3
Now press F9 or manually compile and run this program.