Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- #include <iostream>
- #include <iomanip>
- int main()
- {
- char records = 2;
- char temp[3] = { 0 };
- char a[2][3] = { 0 };
- /*char test[2][3];*/
- cout << "\nEnter A0: ";
- cin.sync();
- cin.getline(a[0], 4);
- cin.sync();
- cout << endl;
- cout << "\nEnter A1: ";
- cin.sync();
- cin.getline(a[1], 4);
- cin.sync();
- cout << endl;
- /*cin >> test[0]
- >> test[1];*/
- for (char i = 0; i < records; i++)
- {
- for (char i2 = 0; i2 < records - i - 1; i2++)
- {
- if (strcmp(a[i], a[i + 1]) > 0)
- {
- strcpy_s(temp, a[i]);
- strcpy_s(a[i], a[i2]);
- strcpy_s(a[i2], temp);
- }
- }
- }
- cout << a[0] << "\n" << a[1] << "\n" ;
- /*<< test << "\n"*/
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement