Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using namespace std;
  2. #include <iostream>
  3. #include <iomanip>
  4.  
  5.  
  6. int main()
  7. {
  8. char records = 2;
  9.  
  10. char temp[3] = { 0 };
  11. char a[2][3] = { 0 };
  12. /*char test[2][3];*/
  13.  
  14. cout << "\nEnter A0: ";
  15. cin.sync();
  16. cin.getline(a[0], 4);
  17. cin.sync();
  18. cout << endl;
  19.  
  20. cout << "\nEnter A1: ";
  21. cin.sync();
  22. cin.getline(a[1], 4);
  23. cin.sync();
  24. cout << endl;
  25.  
  26. /*cin >> test[0]
  27. >> test[1];*/
  28.  
  29. for (int i = 0; i < 2; i++)
  30. {
  31. for (int j = 0; j < 2; j++)
  32. {
  33. if (strcmp(a[i], a[j]) > 0)
  34. {
  35. strcpy_s(temp, a[i]);
  36. strcpy_s(a[i], a[j]);
  37. strcpy_s(a[j], temp);
  38. }
  39. }
  40. }
  41.  
  42. cout << a[0] << "\n" << a[1] << "\n" ;
  43.  
  44.  
  45. /*<< test << "\n"*/
  46.  
  47. system("pause");
  48. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement