Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void fint(int border_size, char name[])
  6.  
  7. {
  8. int a = 0;
  9. while (name[a]!='\0')
  10. {
  11. if (name[a] != '\0')
  12. ++a;
  13. }
  14. for (int i = 0; i < a+ border_size*2; i++)
  15. {
  16. cout<<"-";
  17. }
  18. char fstring[20];
  19. sprintf_s(fstring, "\n|\n|%%-%dc%%s%%%dc\n|\n", border_size, border_size);
  20. printf(fstring,' ',name,'|');
  21. for (int i = 0; i <a+ border_size * 2;i++)
  22. {
  23. cout << "-";
  24. }
  25. cout << endl;
  26. }
  27. int main()
  28. {
  29. char word[50];
  30. cout << " Enter word! ";
  31. cin.getline(word, 50);
  32. fint(10, word);
  33.  
  34. system("pause");
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement