Advertisement
heranchris0430

輸入文字除錯長方體

May 11th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  長方體
  4. //
  5. //  Created by Chris on 2017/5/11.
  6. //  Copyright © 2017年 Chris. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <cstdlib>
  11. #include <math.h>
  12. #include <cstdio>
  13. #include <string>
  14.  
  15. using namespace std;
  16.  
  17. char st[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
  18.  
  19. int main( ) {
  20.     int c,i;
  21.     while((c = getchar()) != EOF){
  22.         for (i=1;st[i]&&st[i] != c;i++);
  23.         if(st[i]) putchar(st[i-1]);
  24.         else putchar(c);
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement