Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <fstream>
- using namespace std;
- ifstream f1("cuvinte.in");
- ofstream f2("cuvinte.out");
- void fisier(char a[50][50])
- {
- char aux[50];
- int n=0,i,j;
- while(f1>>a[n])
- n++;
- for(i=0;i<n-1;i++)
- for(j=i;j<n;j++)
- if(strcmp(a[i],a[j])>0)
- {
- strcpy(aux,a[i]);
- strcpy(a[i],a[j]);
- strcpy(a[j],aux);
- }
- for(i=0;i<n;i++)
- f2<<a[i]<<endl;
- }
- void cuvMij(char s[256])
- {
- int i=0;
- cin.get(s,255);
- cout<<s<<endl;
- while(i<strlen(s))
- {
- strcpy(s,s+1);
- s[strlen(s)-1]=NULL;
- cout<<s<<endl;
- }
- }
- int main()
- {
- //char a[50][50]; in caz ca vrei sa rulezi subprogramul fisier
- //fisier(a);
- char s[256];
- cuvMij(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement