www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Assignment # 2 one third question has solved...

// Yeh Full solution nai ha 2 parts ho gay hain last nai howa abe lecture 13 menay nai lia

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

void DisplayReverse(char[],int);
int main(){
DisplayVUID();
char VuidReverse[12] = {'B','C','1','2','0','4','0','3','4','5','6'};
DisplayReverse(VuidReverse,11);

// Dignol wala abe lecture 13 nai lia abe loo ga aur soba solution baqi post kr do yeh bilkol theak solution ha
}
// 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];
}
}

Views: 524

Attachments:

Replies to This Discussion

Ali Raza Marchal BSCS[Hons] 2nd thanks for sharing

Ali Raza Marchal BSCS[Hons] 2nd & all students

Dear Fellows,

All of you are requested, Please post Only One Discussion For Current Assignment/GDB/Online Quiz and everyone reply/share/discussed his/her data on that same discussion, so that all members get solution & discuss easily on Current Assignment/GDB/Online Quiz.

So please don’t post two or more discussions for one Current Assignment/GDB/Online Quiz, hope you’ll understand and cooperate with us.

thanks

Nice brother

Only idea not a full solution............

#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','4','0','4','1','4','0'};
DisplayReverse(VuidReverse,11);

}
// Display Function
void DisplayVUID(){
char VUID[12] = "MC120404140";
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];
}
}

# 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[] = "MC120203645";

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

falak malik Welcome

Idea For Part One

#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','4','0','4','1','4','0'};
DisplayReverse(VuidReverse,11);

}
// Display Function
void DisplayVUID(){
char VUID[12] = "MC120404140";
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];
}
}

Hints for the last portion storing and printing the id in matrix at diagonal position

void storediagonal(char array2)

{

for (int i = 2; i<11; i++)

{

for (int j = 2, j<11; j++)

{

if (i==j)

cout array2[i] " ";

else

cout "0 ";

}

cout endl;

}

}

#include<iostream.h>
#include<conio.h>
void display_ID()
{
char a[] = "bc110401299";
cout"My VUID is: "aendl;
}
void Display_Reverse(char a[])
{
for(int i=11;i>=0;i--)
{
cout a[i];
}
}
void Str_Diagonal()
{

int a[9][9] ={{0,0,0,0,0,0,0,0,0},{0,9,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,4,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,7,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,3,0},{0,0,0,0,0,0,0,0,1}};

for(int x = 0;x<9;x++)

{
for(int b=0;b<9;b++)
{

couta[x][b]" ";
}
coutendl;

main()
{
display_ID();
char x[] = "mc090407031";
cout"My VUID is reverse order: ";
Display_Reverse(x);
coutendl;
cout"\nDigits of my VUID are stored in the diagonal of the Matrix\n\n";
Str_Diagonal();

getch();
}

#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','4','0','4','1','4','0'};
DisplayReverse(VuidReverse,11);

}
// Display Function
void DisplayVUID(){
char VUID[12] = "MC120404140";
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];
}
}

// Hints for the last portion storing and printing the id in matrix at diagonal position

void storediagonal(char array2)

{

for (int i = 2; i<11; i++)

{

for (int j = 2, j<11; j++)

{

if (i==j)

cout array2[i] " ";

else

cout "0 ";

}

cout endl;

}

}

Top Trends

1

2

3

4

5

Waseem Aziz

------------------------------------

Latest Activity

48 minutes ago
2 hours ago
Muhammad Bilal replied to BBA(6th smes)'s discussion assignment 1 spring 2021 in the group MGT402 Cost & Management Accounting
2 hours ago
★---★ ⱮԱϚҠȺហ ȺచȺហ ★---★ updated their profile
3 hours ago
Mani Siddiqui posted a discussion