VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

cs201 solution

Thursday, May 06, 2010 Posted In Edit This
100% error FREE

#include
#include



void fun(int array[],int arraysize); //Function for Array

main()
{
int num[10];
int x; //counter
for(x=0;x<10;x++)
{
cout<<"Enter the value of array element "<cin>>num[x];
cout<}
fun(num,10); // passing to function.
getch(); // hangout to output.

}

void fun(int array[],int arraysize) // function body.
{

int a,b,c,add; // a,b for counter and C is to tarminate last if condition.
c=0;
add =0;
for(a=0;a<10;a++)
{
add=0;
for(b=0;b<10;b++)
{

if(array[b]==a)
add+=1;
}
if(add>1)
{cout<c=1; // if there is no reapted value . then remain 0.
}
}
if(c!=1)
cout<<" There is no repetition in the array ";

}
..................

That's 99.9% COrrect

#include



void fun(int array[],int arraysize); //Function for Array

main()
{
int num[10];
int x; //counter
for(x=0;x<10;x++)
{
cout<<"Enter the value of array element "<cin>>num[x];
cout<}
fun(num,10); // passing to function.
getch(); // hangout to output.

}

void fun(int array[],int arraysize) // function body.
{

int a,b,c,add; // a,b for counter and C is to tarminate last if condition.
c=0;
add =0;
for(a=0;a<10;a++)
{
add=0;
for(b=0;b<10;b++)
{

if(array[b]==a)
add+=1;
}
if(add>1)
{cout<c=1; // if there is no reapted value . then remain 0.
}
}
if(c!=1)
cout<<" There is no repetition in the array ";

}

............

you didn't specify the range of the numbers that can be input, I made it any number--would have been much simpler for the numbers 0 to 9 only

#include
using namespace std;
void finddups(int[],int);
int main()
{int a[10],i;
for(i=0;i<10;i++)
{cout<<"Enter the value of\narray element "< cin>>a[i];
}
finddups(a,10);
system("pause");
return 0;
}
void finddups(int a[],int n)
{int i,j,k=0,b=0,c,dups[n];
bool done,first;
for(i=0;i dups[i]=0;
for(i=0;i {c=1;
done=false;
for(k=0;k if(a[i]==dups[k])
{done=true;
}
if(!done)
{first=true;
for(j=i+1;j {if(a[i]==a[j])
{ c++;
if(first)
{first=false;
dups[b]=a[i];
b++;
}
}
}
}
if(c!=1)
cout<
}
if(b==0)
cout<<"There is no repetition in the array\n";
}


.................................

#include
using namespace std;
/*Function*/
int count_repeats(int array2[],int compare_element,int j){
int counter = 0,i;
for(i=j;i<10;i++)
{
if(array2[i]==compare_element)
counter++;
j--;
}
return counter;
}
/*Main Method*/
int main(){
int array1[10],i,j,no_of_repeats;
cout<<"Enter the length of the array you want to campre ... ";/*By assingnment set length to 10 time*/
cin>>j;
for(i=0;icout<<"Enter the Elements : ";
cin>>array1[i];
}

for(i=0;i<10;i++){
no_of_repeats = count_repeats(array1,array1[i],i);
if(no_of_repeats > 1){
cout<<"Element "<}
}
return 0;
system("pause");
}
................................


Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo