C/C++の宿題を片付けます 96代目at TECH
C/C++の宿題を片付けます 96代目 - 暇つぶし2ch394:デフォルトの名無しさん
07/09/27 00:07:06
>>391
#include<string.h>
#include<iostream>
using namespace std;
int main(){
  char s[]="ABCDEFGHIJKLMN";
  int size = strlen(s);
  char*end = s + size;
  int shift;
  while(cout << "どれだけシフトしますか--> ",cin>>shift){
    shift %= size;
    if(shift < 0)shift += size;
    rotate(s,end-shift,end);
    cout << s << endl;
  }
  cout<<endl;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch