Docstoc

28

Document Sample
28 Powered By Docstoc
					#include<iostream.h> #include<conio.h> #include<fstream.h> void main() { clrscr(); fstream g("cifre.out",ios::out); int a[10],i,n,j, nrcifre=0,nr,k,b[20],cifra,z=0,p=0,numar; cout<<"n=";cin>>n; numar=n; while(n) {a[++nrcifre]=n%10; n=n/10;} //for(i=nrcifre;i>0;i--) cout<<a[i]<<endl; for(i=1;i<=nrcifre;i++) {nr=0 ; for(j=1;j<=nrcifre;j++) if(a[i]==a[j]) nr=nr+1; if(nr==1) {g<<a[i]; b[++p]=a[i];}} for(i=1;i<=nrcifre;i++) { for(j=i+1;j<=nrcifre;j++) }} cout<<endl; for(i=1;i<=p;i++)cout<<b[i]<<" "; cout<<endl; for(i=1;i<=p;i++) {z=0; k=numar; while(k){ cifra=k%10; if(cifra==b[i]) z++; k=k/10;} cout<<"frecventa aparitiilor "<<z<<endl;} getch();}

if(a[i]==a[j]) {g<<a[i]; b[++p]=a[i];


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:23
posted:10/30/2008
language:
pages:1