Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- int waga(char s[31]) {
- int W = 0, l = strlen(s);
- for (int i = 0; i < l; i++)
- W += s[i];
- return W;
- }
- int main() {
- char sl[30]="XDD";
- FILE *slowa, *zwazone;
- slowa = fopen("Slowa.txt", "r+");
- zwazone = fopen("ZwazoneSlowa.txt", "w+");
- char buf[20];
- while(sl!=""){
- fgets(sl,31,slowa);
- sprintf(buf,"%i",waga(sl));
- fputs(buf,zwazone);
- }
- printf("OK.");
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement