We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

Looking For Something at vustudents.ning.com? Click Here to Search

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

# CS-201 2nd Assignment Solution

Please change MC123456789 with your VU ID everywhere.

#include <iostream.h>
#include <conio.h>

void DisplayVUID(){
char myID[12]={"MC123456789"};
cout "My VUID is: " myID endl;
}

void DisplayReverse(char myID[12]){
cout "My VUID in reverse order: " ;
for(int i = 11; i>=0 ; i--){
cout myID[i];
}
cout endl endl;
}

void  StoreDiagonal(){
int  matrix[9][9]={0};

matrix[0][0]=1;
matrix[1][1]=2;
matrix[2][2]=3;
matrix[3][3]=4;
matrix[4][4]=5;
matrix[5][5]=6;
matrix[6][6]=7;
matrix[7][7]=8;
matrix[8][8]=9;

for(int k=0; k<9; k++){
for (int i=0; i<9; i++){
cout " " matrix[k][i];
}
cout endl;
}

}

main(){
DisplayVUID();
DisplayReverse("MC123456789");
StoreDiagonal();
getch();

}

For more help:

mbilalhamdani@gmail.com

mbilalhamdani@yahoo.com

mbilalhamdani@outlook.com

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

See Your Saved Posts Timeline

Views: 807

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

### Replies to This Discussion

Thanku for sharing. It's really easy to understand.

# CS201 full solution assignment no 2

#include <iostream>
#include <cstdlib>
using namespace std;

void DisplayVUID();
void DisplayReverse(char[],int);
void StoreDiagonal();

int main()

DisplayVUID();
char VUID[12] = {'B','C','1','2','0','4','0','2','8','8','3'};
DisplayReverse(VUID,11);
StoreDiagonal();
system ("pause");

}

void DisplayVUID(){
char VUID[12] = "BC120402883";
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]= 2;
digionalMat[6][6]= 8;
digionalMat[7][7]= 8;
digionalMat[8][8] 3;
for(int row = 0; row < 9; row++){
for(int col = 0; col < 9; col++){
cout digionalMat[row][col];

cout endl;

}

yr tariq bhai after run ky bad 000000000 is tarah ah raha ha

or 0 0 0 0 0 0 0 0 0  is format main kis tarha ahy ga

zoraiz baba  Put    cout" "  after  cout digionalMat[row][col]; }  cout endl;

}

IDEA Solution

# include <iostream.h>
# include <stdlib.h>
# include <string.h>
# include <conio.h>
// ****** Function Prototype *******
void displayVUID(char arg []);
void displayRevVUID(char ar []);
void matrixVUID(char str[]);

// ****** Main Function *******
void main () {
clrscr();
char myID[] = “MC120202689″;

displayVUID(myID);
displayRevVUID(myID);
matrixVUID(myID);
} // end of main
// ****** Display VU ID ********
void displayVUID(char arg[]){
int len = strlen(arg);
cout”Display VU ID”endl;
cout”=============”endl;
for (int i = 0 ; i<len ; i++ )
coutarg[i];
coutendlendl;
}
// ****** Display Reverse VU ID ********
void displayRevVUID(char arg[]){
int len = strlen(arg);
cout”Display Reverse VU ID”endl;
cout”=====================”endl;
for (int i = len-1 ; i>=0 ; i– )
coutarg[i];
coutendlendl;
}
//******** MATRIX *******
void matrixVUID(char str[]){
cout”Display Matrix VU ID”endl;
cout”====================”endl;
int len = strlen(str);
for (int i = 0 ; i<len ; i++){
for (int j = 0 ; j<len ; j++){
if (i == j)
coutstr[i]” “;
else
cout”0 “;
} // end of inner loop
coutendlendl;
} // end of outer loop
} // end of function
No related posts.

#include <iostream>
#include <stdlib.h>
using namespace std;
void DisplayVUID();

void DisplayReverse(char[],int);
int main(){
DisplayVUID();
char VuidReverse[12] = {'M','C','1','2','0','2','0','2','6','8','9'};
DisplayReverse(VuidReverse,11);

}
// Display Function
void DisplayVUID(){
char VUID[12] = "BC120403456";
cout "My VUID is: ";
for(int i=0; i<12; i++){
cout VUID[i];
}
}
// Reverse Function
void DisplayReverse(char* VuidReverse, int arraysize){
cout "\nMy VUID in reverse order: ";
for(int i = arraysize - 1; i>=0; i--){
cout VuidReverse[i];
}
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;
}
}

## Latest Activity

1 hour ago
afaq posted a discussion

### cs 312 assignment 2 solution required

5 hours ago
6 hours ago
Zain Kazimi posted a discussion

### Self Poetry Dedicated to Nasir Kazimi

6 hours ago
6 hours ago
+ ! ! ! ! ! ! ! ! STUDENTs +++ liked ♦_"Tooba"_♦'s discussion QUIZ NO 1
6 hours ago
+ M.Tariq Malik's 17 discussions were featured
6 hours ago
+ M.Tariq Malik added a discussion to the group EDU401 Contemporary Issues and Trends in Education

### EDU401 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material

6 hours ago
+ M.Tariq Malik liked Zari's discussion cs502 important topics for mid
7 hours ago

1

2