Assignment No. 02 CS201: Introduction to Programming |
Total Marks: 20
Due Date:15/05/2013 |
||
Instructions: Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
Guidelines:
|
|||
Assignment |
|
||
Problem Statement:
Write a C++ program that prints your VUID by using character array, then prints your VUID in reverse order by using character array and finally stores and displays the digits of your VUID at the diagonal of 9 x 9 Matrix by using two dimensional integer array. You are required to perform these tasks with the help of following three functions:
Detailed Description:
Description of above functions are as follows:
DisplayVUID() This function stores your VUID in character array (for example bc020455055) and simply prints it.
DisplayReverse(char []) This function takes the character array as parameter having your VUID and displays it in reverse order.
StoreDiagonal() This function stores the digits of your VUID at the diagonal of 9 x 9 matrix, for example VUID i.e. bc020455055 contains the digits 020455055, so you have to store these digits in the diagonal of the 9 x 9 matrix as follows: And finally prints the whole matrix.
Following is the sample run of your program: |
|||
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[] = “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
Share your Ideas about this Assignments here…………..
plz help me cs201 in assignment 2 solution best
plz help me CAPTCHA Code. i don’t know captcha code
Simply right the digits you see in picture of captcha ……….
pls help me out mre ko to es aasignmnt ki samj he nhi arhi ……. pls help kr do yr