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.

Assignment No. 2 Semester: Fall 2019

CS201 – Introduction to Programming

Total Marks: 20

 

Due Date:

02-12-2019

 

Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

 

o        Assignment is submitted after due date.

o        Submitted assignment does not open or file is corrupt.

o        Assignment is copied (From internet/students).

 

Software allowed to develop Assignment

 

-          Dev C++

 

Objectives:

In this assignment, the students will learn:

  • How to fill / populate a two-dimensional array using random numbers.
  • How to write user defined functions and pass an array to them as parameter.
  • How to implement switch statement to process specific options.
  • How to compare elements of array.
  • How to find transpose of an array.

 

Assignment Submission Instructions

You are required to submit only .cpp file on the assignments interface of CS201 at VU-LMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.

 

 

Lectures Covered: This assignment covers Lecture # 11-15.

Deadline: The deadline to submit your assignment solution is 02-12-2019. Your assignment must be submitted within the due date through VU-LMS. No assignment will be accepted through email after the due date.

 

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

.

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

Attachments:

Replies to This Discussion

CS201 ASSIGNMENT NO.2 Solution
# include <iostream>
# include <stdlib.h>
# include <cstdlib>
# include <ctime>

Using name space Std;

Int multiArray [10][10];
Int rows=10;
Int cols=10;
Int chk=0;

Void populateArray(){
srand (time(time));
for(int i=0; i< rows;i++){
for(int j=0; I < cols;++){
multiArray[i][j]= (rand()%100) + 1;
}
}
cout ” A 2-Dimensional Array is created successfully…! \n”;
};


Void showElements(){
If (multiArray [chk][chk]==0{
cout ” Sorry! Array is empty, Please first fill it by chosing option\\n”;
}
else {
cout ” Array is given below…!\n”;
cout _ _ _ _ _ _ _ _********_ _ _ _ _ _ _ _********_ _ _ _ _ _ _ _\n”;

for (int i=0; I < rows; i++){
cout ” l tc” i+ l;
}
cout ”\n”;

for(int i=0 ; I < rows; i++){
cout ‘’R’’ i+1 ’’\t”;
for(int ;=0; I < cols; j++){
cout transposed Array [i][j] ”|t”;
}
cout ”|n”;
}
}
};

Void showLargestElement(){
Int temp;
Int max=0;
Int rowNum; colNum;

If (multiArray [chk][chk]==0){
cout ” Sorry ! Array is empty , Please first fill it by chosing 1\n”;
}
else{
for(int i=0; i< rows; i++){
for(int j=0; j < cols ; j++){

temp=multiArray[i][j];
If(max <= temp){
max = temp;
rowNum=i+l;
colNum = i+l;
}
}
}
cout ”Maximum number of the Array ‘’ max ’’ is at :
At (R” rowNum ” , c: colNum ”)\n”;
}
};

Void transposedArray(){

Int transposed Array [10][10];

If (multiArray [chk][chk]==0){
cout ” Sorry Array is empty, Please first fill it by chosing option 1\n”;
}
Else {
for(int i=0; < rows; i++){
for(int j=0; j < cols; j++){
transposed Array [j][i]= multi Array[i][j];
}
}
cout ” Transposed Array is given below …!\n”;
cout ” _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _\n”;
for(int i=0; I < rowa; i++){
cout ”\tc” i+1;
}
cout ‘’\n’’;
for(int i=0 ; I < rows; i++){
cout ‘’R’’ i+1 ’’\t”;
for(int ;=0; I < cols; j++){
cout transposed Array [i][j] ”\t”;
}
cout ”\n”;
}
}
};
While (is True){
cout ” _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _\n”;
cout ”\n\ tplease enter a number (1-4) to …!\”;
cout ”\t1: PoPulate a 2- Diemesional Array with integers (1-100)\n”;
cout ”\t2: Display the elements of the 2-dimensional Array\n”;
cout ”\t3:Display the largest element with its row and colum I \n”;
cout ”\t4:Find and show the transpose of the Array \n\n”;
cout ” _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _******** _ _ _ _ _ _ _ _\n”;
cin >> toDo;
cout ”\t your choice is == >” to Do ”|”;

Switch (to Do){
}
Return 0;
}

CS201_Assignmnet_2_Solution_Fall_2019_vustudents.ning.com

link below 

CS201_Assignmnet_2_Solution_Fall_2019_vustudents.ning.com.docx

CS201 Introduction to Programming Assignment 1 Solution Fall 2019


Please check this ... it's working 

#include <iostream>
#include <ctime> // For time()
#include <cstdlib> // For srand() and rand()
#include <iomanip>
#include <algorithm>

using namespace std;
int table[10][10] = {0,0};
const int row=10;
const int column=10;
const int flag = 0;
void poulateArray(){
srand(time(0)); // Initialize random number generator.


for(int r=0; r<row; r++)//row
{
for(int c=0; c<column; c++)
{
table [r][c] = (rand()%100) + 1;
}
}
cout "Array is poulated" endl;
};
void showElements (){

if(table[flag][flag] == 0){
cout "Array is empty , first poulate it by pressing 1" endl;
}
else
{
for(int r=0; r<row; r++)//row
{
for(int c=0; c<column; c++)
{
cout table [r][c] "\t";
}
cout endl;
}
}


};
void showLargestElement (){
int temp;
int max = 0;
int indexRow;
int indexColumn;
if(table[flag][flag] == 0){
cout "Array is empty , first poulate it by pressing 1" endl;
}else{

for(int r=0; r<row; r++)//row
{
for(int c=0; c<column; c++)
{
temp = table[r][c];
if(max <= temp){
max = temp;
indexRow = r+1;
indexColumn = c+1;
}
}//second
}//first loop
cout "the max value is" max " which is on Row" indexRow " and cloumn" indexColumn endl;
}
};
void transposeArray (){
int copyArray[10][10];
if(table[flag][flag] == 0){
cout "Array is empty , first poulate it by pressing 1";
}else{

for(int r=0; r<row; r++)//row
{
for(int c=0; c<column; c++)
{
copyArray[c][r]= table[r][c];

}//second
}//first loop

for(int r=0; r<row; r++)//row
{
for(int c=0; c<column; c++)
{
cout copyArray [r][c] "\t";
}
cout endl;

}
}
};

int main()
{
int choice;
bool isTrue = true;
while(isTrue)
{
cout "1.Press 1 to populate a two-dimensional array with integers from 1 to 100." endl;
cout "2.Press 2 to display the array elements." endl;
cout "3.Press 3 to display the largest element present in the array along with its row and column index." endl;
cout "4.Press 4 to find and show the transpose of the array." endl;
cout "Please select an option , use number from 1 to 5 ";
cin >> choice;
cout "--------------------------------------------------------" endl;
switch(choice){
case 1 : poulateArray();
break;
case 2 : showElements();
break;
case 3 : showLargestElement();
break;
case 4 : transposeArray();
break;
default : isTrue = false;
break;
}
}

return 0;
}

Sir ya assign mjhy ning k member ny send ki thi.or mane ider post kr di.

CS201 Introduction to Programming Assignment 1 Solution Fall 2019

#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int selectGrade(){
 int grade = 0;
 
 cout"1 : First Grade\n";
 cout"2 : Second Grade\n";
 cout"3 : Third Grade\n";
 cout"4 : Fourth Grade\n";
 cout"5 : Fifth Grade\n"; 
 
 cout"\nPlease select grade, use numbers 1 to 5: ";
 
 do {
  cin>>grade;
  if(grade >= 1 && grade <= 5){
   break;
  }
  else {
   cout"\nGrade must be between 1 and 5\n";
   cout"Invalid choice, please select correct grade: ";
  }
 } while(true);
 return grade; 
}
void createQuestions(int l, int u, int q){
 
 int firstNum = 0, secondNum = 0;
 
 for(int i = 1; i <= q; i++){
  
  firstNum = l + (rand() % (u - l + 1));
  secondNum = l + (rand() % (u - l + 1));
   
  coutsetw(2)i".";
  
  if(rand() % 2 == 0){
   cout"  ("firstNum" + "secondNum") = ______\t\t";;
  }
  else{
   if(firstNum > secondNum) {
    cout"  ("firstNum" - "secondNum") = ______\t\t";
   }
   else{
    cout"  ("secondNum" - "firstNum") = ______\t\t";
   }   
  }
  
  if(i % 3 == 0){
   cout"\n";
  }
 } 
}
void generatePaper(int grade, int questions) {
 
 int lowerLimit, Upperlimit;
 
 if(grade == 1){
  lowerLimit = 10;
  Upperlimit = 99;
  createQuestions(lowerLimit, Upperlimit, questions);
 }
 else if(grade == 2){
  lowerLimit = 100;
  Upperlimit = 999;
  createQuestions(lowerLimit, Upperlimit, questions);
 }
 else if(grade == 3){
  lowerLimit = 1000;
  Upperlimit = 9999;
  createQuestions(lowerLimit, Upperlimit, questions);
 }
 else if(grade == 4){
  lowerLimit = 10000;
  Upperlimit = 99999;
  createQuestions(lowerLimit, Upperlimit, questions);
 }
 else if(grade == 5){
  lowerLimit = 100000;
  Upperlimit = 999909;
  createQuestions(lowerLimit, Upperlimit, questions);
 }
}
main(){
 
 int grade = 0, numQuestions = 0;
 grade = selectGrade();
 
 cout"Enter number of questions you want to generate: ";
 cin>>numQuestions;
 
 coutendl;
 generatePaper(grade, numQuestions); 
 coutendl;
 system("pause");
}

RSS

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

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

.