Sponsored Links


Results 1 to 6 of 6

Thread: CS201 Introduction to Programming Assignment No.2 Solution Spring Semester 2013

  1. #1
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,579

    18 CS201 Introduction to Programming Assignment No.2 Solution Spring Semester 2013

    Sponsored Links1




    CS201 Introduction to Programming Assignment No.2 Solution Spring Semester 2013


    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:
    DisplayVUID()
    DisplayReverse(char [])
    StoreDiagonal()

    Sponsored Links

    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:

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,579
    Idea Solution:


    #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','3','4','5','6'};
    DisplayReverse(VUID,11);
    StoreDiagonal();

    system("pause");
    cout "\n\n\n";
    cout "*****************************************" endl;
    cout "* Name: Ali Raza Marchal \t\t*" endl;
    cout "* Date: Saturday, May 11, 2013 \t\t*" endl;
    cout "* facebook.com/ali.mirchal \t\t*" endl;
    cout "* Virtual University BC120403456\t*" endl;
    cout "*****************************************" endl;
    return 0;
    }

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

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    1

    thanks

    can i ask k ye sab word file mai submit kerwana hai ya koi software bhi hai?

  4. #4
    note pad may ho ga i think. word may to bilkul nahi anam

  5. #5
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,579
    yes note pad mein h ho ga

  6. #6
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,227
    In this code you will get errors like after cout Cascading sign << is missing so when you are copying this code to dev c++ then you will get this error so it is called syntax error please put cascading sign << after cout and other where it is missing like before endl

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CS201-Introduction to Programming Assignment No.2 Spring semester 2014
    By vuassignments in forum Assignments & Solutions
    Replies: 0
    Last Post: 07-09-2014, 04:14 PM
  2. Replies: 0
    Last Post: 07-13-2013, 07:07 PM
  3. Replies: 1
    Last Post: 06-24-2013, 10:39 PM
  4. Replies: 1
    Last Post: 04-27-2013, 03:02 PM
  5. Replies: 2
    Last Post: 11-20-2010, 09:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft