Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. void estraiNomeCognome(studente* a,char* nomeCogn,int n){
  2.  
  3. char nome[50];
  4. char cognome[50];
  5.  
  6. for(int i=0;i<strlen(nomeCogn);i++){
  7.  
  8. if(nomeCogn[i]==';'){
  9.  
  10. for(int j=0;j<i;j++){
  11. nome[j]=nomeCogn[j];
  12. }
  13.  
  14. for(int j=i+1;j<strlen(nomeCogn);j++){
  15. cognome[j]=nomeCogn[j];
  16. }
  17.  
  18. for(int j=0;j<strlen(nome);j++){
  19.  
  20. if(nome[j]==','){
  21. nome[j]=' ';
  22. }
  23.  
  24. }
  25.  
  26. for(int j=0;j<strlen(cognome);j++){
  27.  
  28. if(cognome[j]==','){
  29. cognome[j]=' ';
  30. }
  31.  
  32. }
  33.  
  34. cout<<nome<<endl;
  35. cout<<cognome<<endl;
  36. system("pause");
  37.  
  38. }
  39.  
  40. }
  41.  
  42. nome[strlen(nome)+1]='\0';
  43. cognome[strlen(cognome)+1]='\0';
  44.  
  45. strcpy(a[n].nome,nome);
  46. strcpy(a[n].cognome,cognome);
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement