utility.h

来自「这是本人精心搜集的关于常用图论算法的一套源码」· C头文件 代码 · 共 15 行

H
15
字号
bool user_says_yes( )
{ char c;
  bool initial_response = true;
  do{ // Loop until an appropriate input is received.
      if (initial_response)
          cout<<" (y,n)? " <<flush;
      else
          cout << "Respond with either y or n: "<<flush;
      do{                          // Ignore white space.
          c=cin.get();
        }while(c == '\n' || c == ' ' || c=='\t');
      initial_response=false;
    }while(c!='y' && c!='Y' && c!='n' && c!='N');
  return(c=='y' || c=='Y');
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?