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 Assignment No 02 Solution & Discussion Due Date: 02 Dec 2016

Assignment

 

 

  • Write a program that takes input of 10 integers into an array.
  • Give two options to the user:

1= copy odd numbers from the array to a new array (odd[] array) and sort “odd[]”  array in ascending order

and

2= copy even numbers from the array to a new array (even[] array) and sort “even[]” array in ascending order

 

 

  • Write a function that accept (odd[] or even[]) array and sort it
  • Use bubble sort technique to sort the given array
  • Display the sorted array.

    Hint:: you can use 3 arrays like arry[], odd[], even[].

 

 

 

 

Sample output:

 

 

  • Taking input for array from user

 

 

 

  • Ask user for an option

 

 

 

  • Pass array to function and display sorted array

 

 

 

 

 

 

 

Deadline:

The deadline to submit your assignment solution is 2nd December, 2016. Your assignment must be submitted within the due date through VULMS. 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: 3975

.

+ 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

ap jahnan pr return0 likha hoa hy waha pr us ko remove kr k getch(); likhy gy to apka program crash nai ho ga

CS201_2nd-Assignment-Final-Solution

Attachments:

#include 
using namespace std;
void sort (int arry[], int b){
int temp;
for (int i =0; iarry[j+1]){

temp = arry[j];
arry[j]=arry[j+1];
arry[j+1] = temp;
}
}
}
}
int main (){
int array[10];
int odd [10];
int even [10];
int option, a =0;
cout "Enter 10 Element for Array: \n"; for (int i =0; i<10; i++){ cin>> array [i];
}
cout "For odd Number in Accending Order: Press 1 \n"; cout "For Even Number in Accending Order: Press 2 \n"; cin>> option;
if (option==1){
for (int i=0; i<10; i++) { if (array[i]%2==1){ odd[a] = array[i]; a++; } } sort(odd, a); cout " Total Odd Numbers Are: "/p>

#include<iostream.h>
main()
{
//declare variables

int number, digit;

//prompt the user for input

cout "Please enter four number:";

cin >> number;

// get the first digit and display it on screen

digit = number % 10;

cout "The digits are: ";

cout digit ", ";

// get the remaining three digits number

number = number / 10;

// get the next digit and display it

digit = number % 10;

cout digit ", ";

// get the remaining two digits number

number = number / 10;

// get the next digit and display it

digit = number % 10;

cout digit ", ";

// get the remaining one digit number

number = number / 10;

// get the next digit and display it

digit = number % 10;

cout digit;
return 0;
system ("pause");

}

#include <iostream>

using namespace std;
void display(int dis[10] ,int xx);


void bubblesort (int arr[10] ,int x)
{
int temp;
int num[x];
for (int i=0 ; i<=x ; i++)
{num[i]=arr[i];}

for (int i=0 ; i<=x ; i++)
{
for (int j=0 ; j<x ; j++)
{
if (num[j]>num[j+1])
{
temp = num[j];
num[j]=num[j+1];
num[j+1]=temp;
}
}
}
display (num, x);
}
main()
{
int arr[10];
int j=0 , k=0,E=0,O=0;
cout"Enter 10 values in array"endl;
for (int i=0 ; i<10 ; i++)
{ cin>> arr[i];}

/////////////////////////////////////////////
for (int i=0 ; i<10 ; i++)
{
if (arr[i]%2==0) // count even and odd values
{E++;}
else
{O++;}
}
cout E" "Oendl;
///////////////////////////////////////////

int odd[O] , even[E];

for (int i=0 ; i<10 ; i++) // put even number in even array
{
if (arr[i]%2==0)
{even[j]=arr[i];j++;} // put odd numbe in odd array
else
{odd[k]=arr[i];k++;}
}


display (odd, O);
display (even, E);

cout"Press 1 for odd array"endl;
cout"Press 2 for even array"endl;
cout endl;
cout endl;
cout "REQUIRED Sorted array"endl;
int x;
cin>>x;
if (x==2)
{bubblesort (even, E);}
else if (x==1)
{bubblesort (odd , O);}
else
{cout"You enter a wroung number "endl;}
}


////////////////////////////
void display(int dis[10] , int xx)
{
for (int i =0; i<xx ; i++)
{coutdis[i]" ";}
coutendl;
}

//////////////////////////////////////////

CS201_2nd-Assignment-Final-Solution_

Attachments:

I've already written this assignment, check attached file. I have the issue at the end of the sorted array.
Remove // from the very last lines and check my error. And it would be great if you point out the error. Thanks

Attachments:

Final

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

using namespace std;

void sort(int a[], int size);

main()
{

int inputNo[10];
int oddNoCount=0;
int evenNoCount=0;
int choice=0;

cout"10 Elements  array\n";
for(int i=0; i<10; i++)
{
cin>>inputNo[i];
if(inputNo[i]%2==0)
evenNoCount++;
else
oddNoCount++;
}

int oddNo[oddNoCount];
int evenNo[evenNoCount];
int oddIndex=0;
int evenIndex=0;

for(int i=0; i<10; i++)
{
if(inputNo[i]%2==0)
{
evenNo[evenIndex++]=inputNo[i];

}
else
{
oddNo[oddIndex++]=inputNo[i];
}

}

userChoice:
cout"\nFor Odd Numbers Press 1\n";
cout"For Even Numbers Press 2\n";

cin>>choice;
if(choice==1)
{
cout"Total Odd Number in Array is = "oddNoCount"\n\n";
cout"Sorted Odd Elements:-\n";
sort(oddNo,oddNoCount);
for(int i=0; i<oddNoCount; i++)
{
coutevenNo[i]" ";
}
}
else if(choice==2)
{
cout"Total Even Number in Array is = "evenNoCount"\n\n";
sort(evenNo,evenNoCount);
cout"Sorted Even Elements:-\n";
for(int i=0; i<evenNoCount; i++)
{
coutevenNo[i]" ";
}

}
else
{
cout"Invalid Choice\nPress any key\n";
getche();
goto userChoice;

}
getch();
return 0;
}

void sort(int input[], int size)
{
int temp;
for(int i=1;i<size;++i)
{
for(int j=0;j<(size-i);++j)
if(input[j]>input[j+1])
{
temp=input[j];
input[j]=input[j+1];
input[j+1]=temp;
}
}
}

brother plz guide me .. assignment winRaR mai compress kr k upload karni hai naw?

nhi just .cpp file sbmt krwani hai

RSS

Latest Activity

Fazal ur Rehman replied to + M.Tariq Malik's discussion SOC101 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 21-11-2019 in the group SOC101 Introduction to Sociology
30 minutes ago
Fazal ur Rehman joined + M.Tariq Malik's group
30 minutes ago
Khuzamah Rasheed replied to + M.Tariq Malik's discussion EDU402 Curriculum Development Assignment No 01 Fall 2019 Solution & Discussion in the group EDU402 Curriculum Development
34 minutes ago
Khuzamah Rasheed joined + M.Tariq Malik's group
34 minutes ago
ALEENA and Adilshahid are now friends
37 minutes ago
Sami joined + M.Tariq Malik's group
38 minutes ago
Khuzamah Rasheed posted a status
"full solution"
40 minutes ago
Khuzamah Rasheed posted a status
"kisi ke pas 402 code ki assignment hy fall 2019"
40 minutes ago
+ ! ! ! ! Mehαr Mαh꧂ posted a video

Wintergatan - Marble Machine (music instrument using 2000 marbles)

Get the audio track "Marble Machine" by Wintergatan: https://wintergatan.bandcamp.com/track/marble-machine Marble Machine built and composed by Martin Molin ...
48 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MTH501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 19-11-2019 in the group MTH501 Linear Algebra
48 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT603 Strategic Management
49 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion
50 minutes ago
+ M.Tariq Malik added a discussion to the group MGT603 Strategic Management
50 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT501 Human Resource Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT501 Human Resource Management
51 minutes ago
ALEENA replied to + M.Tariq Malik's discussion MTH501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 19-11-2019 in the group MTH501 Linear Algebra
51 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MGT501 Human Resource Management Assignment No 01 Fall 2019 Solution & Discussion
51 minutes ago
ALEENA joined + M.Tariq Malik's group
51 minutes ago
+ M.Tariq Malik added a discussion to the group MGT501 Human Resource Management
51 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion HRM613 Performance Management Assignment No 01 Fall 2019 Solution & Discussion in the group HRM613 Performance Management
52 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion HRM613 Performance Management Assignment No 01 Fall 2019 Solution & Discussion
52 minutes ago

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

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