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

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.

CS201 Introduction to Programming Assignment No. 02 Solution and Discussion Spring 2013 Due Date 15-05-2013

Assignment No. 02
Semester: Spring 2013

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:

 

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

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:

 

  • Basic concepts of C/C++ language and Programming
  • Dealing with Data types
  • For Loop
  • Expressions
  • Character Array
  • Functions
  • Multidimensional Integer Array

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ rules while writing variable names, function names etc
  • Use only dev-C++ for this assignment.

 

 

 

 

 

 

 

 

 

 

 

 

 

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:

  • DisplayVUID()
  • DisplayReverse(char [])
  • StoreDiagonal()

 

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:

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ 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: 1401

.

+ 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?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

Little Chef gud keep it up 

Note for All Members: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

Thanks Brother May Allaha Bless you a lot

thanks 

#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);


}
// Ready Function
// 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];
}
}

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

#include<stdlib.h>
void display_ID()
{
char a[] = "bc120400299";
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[] = "mc130400031";
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();
}

Correct 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','3','0','8','3','1','0','5','5'};
DisplayReverse(VUID,11);
StoreDiagonal();

system("pause");
cout "\n\n\n";
return 0;
}

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

 Malika Eman gud keep it up & thanks a lot for sharing 

Note for All Members: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

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; 

}

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);


}
// Ready Function
// 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;
}
}

RSS

Latest Activity

Aijaz khan updated their profile
19 minutes ago
Aijaz khan added a discussion to the group CS605 Software Engineering-II
25 minutes ago
Aijaz khan joined + M.Tariq Malik's group
27 minutes ago
Ikra butt added a discussion to the group CS411 Visual Programming
35 minutes ago
Ikra butt joined + M.Tariq Malik's group
37 minutes ago
+ ՏhehαrZααD + replied to + ՏhehαrZααD +'s discussion Assalamu Alaikum
55 minutes ago
Kashif Iqbal added a discussion to the group FIN624 Islamic Mode of Financing
59 minutes ago
Kashif Iqbal joined + M.Tariq Malik's group
1 hour ago
Kashif Iqbal posted a discussion
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked UMER UMER's discussion online earing
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked +¢αяєℓєѕѕ gιяℓ's discussion چاۓ
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked UMER UMER's discussion Modern Era and Our Obligations on Our Loved Ones
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked Muhammad Ishtiaq's discussion Past Papers
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked Syeda's discussion MTH601 - Operations Research solved....
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked ٢ دن's discussion زندگی گزارنے کا فارمولا
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked Muhammad Ishtiaq's discussion Assignment
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked + ! ! ! ! ! ! ! ! ! ! ! ! ! ! !'s discussion رشتوں میں بیلنس قائم کریں
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked Waseem Khan's discussion CS510 Assignmnet 1 Solution
1 hour ago
+ ! ! ! ! ! ! ! ! ! AG liked Waseem Khan's discussion CS619 Final project Help
1 hour ago
+ ՏhehαrZααD + posted a discussion
1 hour ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service