Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void wyrownanie_do_prawej(char* text, int* dlugosci_wyrazow, int szerokosc)
- {
- int i;
- printf("%s\n\n\n", text);
- for(i = 1; i <= szerokosc; i++)
- {
- printf("%d",i % 10);
- }
- printf("\n");
- i = 0;
- int x = 0;
- int j = 0;
- int c = 0;
- int pomoc = 0;
- float ilosc_spacji = 0;
- int wyraz = 0;
- i=0;
- while(text[i] != NULL)
- {
- while (pomoc <= szerokosc)
- {
- pomoc += dlugosci_wyrazow[j] + 1;
- j++;
- wyraz++;
- }
- while(pomoc <= szerokosc && ilosc_spacji - int(ilosc_spacji) == 0)
- {
- j--;
- wyraz--;
- pomoc = pomoc - (dlugosci_wyrazow[j]+1);
- ilosc_spacji = (szerokosc-pomoc)/(wyraz-1) + 1;
- }
- pomoc = 0;
- wyraz = 0;
- while(1)
- {
- if(text[i] != ' ')
- {
- printf("%c", text[i]);
- i++;
- x++;
- }
- if(x == szerokosc)
- {
- x = 0;
- i++;
- printf("\n");
- break;
- }
- if(text[i] == ' ')
- {
- for(c = 0; c < ilosc_spacji;c++)
- {
- x++;
- printf(" ");
- }
- i++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement