Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Exerc08(int n)
- {
- String y="";
- String []a = new String[n];
- String temp="";
- int i;
- for(i=0;i<n;i++)
- {
- a[i]=IO.readString("Entre com o nome: ");
- for(int t=0; t<a[i].length();t++)
- {
- if (a[i].charAt(t)>='a' && a[i].charAt(t)<='z')
- {
- y +=(char)((int)(a[i].charAt(t))-32);
- }
- else
- {
- y+=a[i].charAt(t);
- }
- }
- a[i]=y;
- y="";
- }
- for(i=0;i<n-1;i++)
- {
- for(int t=0; t < a[i].length(); t++)
- {
- if(a[i].charAt(t) < a[i+1].charAt(t) )
- {
- break;
- }
- else if(a[i].charAt(t) > a[i+1].charAt(t))
- {
- temp+=a[i];
- a[i]=a[i+1];
- a[i+1]=temp;
- temp="";
- break;
- }
- }
- }
- for(i=0;i<n;i++)
- {
- IO.println(""+a[i]);
- }
- }
- public static void Exercicio08()
- {
- int n;
- n= IO.readint("Entre com o numero de pessoas:");
- Exerc08(n);
- }
Add Comment
Please, Sign In to add comment