Sunday , 24 November 2024

CS201 Assignment no 02 complete idea solution has been uploaded

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.

Check Also

CS201 Assignment no 02 Spring 2013 Solution has been uploaded

  Assignment No. 02 Semester: Spring 2013 CS201: Introduction to Programming Total Marks: 20   …

Leave a Reply

Your email address will not be published. Required fields are marked *

*