Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <locale.h>
  5.  
  6. #pragma warning (disable: 4996)
  7.  
  8. typedef struct Word
  9. {
  10.     char word[100];    //word itself
  11.     char transA[100];  //translate 1
  12.     char transB[100];  //translate 2
  13.     char typeA;        //verb, noun, adj
  14.     char typeB;        //verb, noun, adj
  15.     char example[100]; //example sentence
  16.     char dateAdded[11]; //DD.MM.YYYY   10 + '\n'
  17.     char transRating;  //0-10
  18. }Word;
  19.  
  20. typedef struct Node
  21. {
  22.     struct Word word;  //word struct
  23.     struct Node *next;
  24. }Node;
  25.  
  26. int main()
  27. {
  28.     FILE *fpBg;//, *fpEng, *fpGer;
  29.  
  30.     if ((fpBg = fopen("bg.lang", "rb")) == NULL) { exit(10); }
  31.     //if (fpEng = fopen("eng.lang", "rb") == NULL) { exit(11); }
  32.     //if (fpGer = fopen("ger.lang", "rb") == NULL) { exit(12); }
  33.  
  34.     Node *head = NULL;
  35.     head = malloc(sizeof(head));
  36.  
  37.     strcpy(head->word.word, "Test");
  38.     strcpy(head->word.transA, "Тест");
  39.     strcpy(head->word.transB, "Testttt");
  40.     head->word.typeA = 'n';
  41.     head->word.typeB = 'n';
  42.     strcpy(head->word.example, "Testing this modafuka");
  43.     strcpy(head->word.dateAdded, "12.12.1998");
  44.     head->word.transRating = '5';
  45.  
  46.     setlocale(LC_ALL, "");
  47.     printf("%ls\n", L"s:\\яшертыHello");
  48.  
  49.     printf("%s\n", head->word.word);
  50.     printf("%s\n", head->word.transA);
  51.     printf("%s\n", head->word.transB);
  52.     printf("%c\n", head->word.typeA);
  53.     printf("%c\n", head->word.typeB);
  54.     printf("%s\n", head->word.example);
  55.     printf("%s\n", head->word.dateAdded);
  56.     printf("%c\n\n", head->word.transRating);
  57.  
  58.  
  59.     return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement