SHARE
TWEET

字串比對

heranchris0430 Mar 20th, 2017 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ConsoleApplication1.cpp : 定義主控台應用程式的進入點。
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     while (1) {
  13.         string a = { "" }, b = { "" };
  14.         int n[2] = { 0 };
  15.  
  16.         cout << "輸入二個字串";
  17.         cin >> a >> b;
  18.  
  19.         n[0] = size(a);
  20.         n[1] = size(b);
  21.  
  22.         if (n[0] == n[1])
  23.             cout << "YES" <<endl;
  24.  
  25.         if (n[0] != n[1])
  26.             cout << "NO" <<endl;
  27.  
  28.         system("PAUSE");
  29.         system("CLS");
  30.     }
  31.     return 0;
  32. }
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top