小编Cer*_*ran的帖子

为什么我们在读取输入后调用cin.clear()和cin.ignore()?

谷歌代码大学的C++教程曾经有过这样的代码:

// Description: Illustrate the use of cin to get input
// and how to recover from errors.

#include <iostream>
using namespace std;

int main()
{
  int input_var = 0;
  // Enter the do while loop and stay there until either
  // a non-numeric is entered, or -1 is entered.  Note that
  // cin will accept any integer, 4, 40, 400, etc.
  do {
    cout << "Enter a number (-1 = quit): ";
    // The following line accepts input …
Run Code Online (Sandbox Code Playgroud)

c++ iostream input

73
推荐指数
3
解决办法
18万
查看次数

如何使用Git Bash使用Windows网络路径

Windows中使用\\servername\share\path\to\folder语法表示网络资源的路径.如何在使用Unix风格路径的Git Bash中使用这样的文件夹?

windows path git-bash

67
推荐指数
3
解决办法
4万
查看次数

为什么Win32 API中没有使用标准数据类型?

我一直在学习Visual C++ Win32编程.为什么有像数据类型DWORD,WCHAR,UINT等来代替,比如说unsigned long,char,unsigned int等?

我必须记住何时使用WCHAR而不是const char*,这真的很烦我.为什么不首先使用标准数据类型?如果我记住Win32等价物并将它们用于我自己的变量,它会有帮助吗?

c c++ winapi types

17
推荐指数
3
解决办法
2366
查看次数

如何在C++中创建原子枚举?

atomic包含许多不同变量类型的原子版本.但是,它不包含原子枚举类型.有没有办法使用原子枚举或自己制作?据我所知,我唯一的选择是不使用枚举或使用互斥锁/信号量来保护它们.

注意:我发现这个错误报告提到"std :: atomic enum support",但我没有在C++标准中看到任何提及原子枚举类型,所以我不确定它是指什么.

c++ enums atomic c++11

17
推荐指数
2
解决办法
1万
查看次数

git fetch origin不会获取所有分支

我读了这个问题的答案,git fetch origin应该取得所有原始分支.在我的情况下,它似乎并没有给我任何分支.这是我做的:

最初,一个名为origin的远程有7个分支.我克隆了它.git branch然后只返回master.我做了git fetch origin,git branch仍然只是表演master.如何在不单独获取的情况下获取其他6个分支?

git branch git-fetch git-clone

12
推荐指数
1
解决办法
8570
查看次数

我应该使用C++标准或Windows API中的条件变量吗?

当实施条件变量成一个Win32 C++程序,这将是最好使用Win32函数,类,和数据类型(例如CreateThread,SleepConditionVariableCS,WaitForSingleObjectEx,ReleaseMutex,CONDITION_VARIABLE),或那些来自C++ 11标准库(例如thread,wait,join,unlock,condition_variable)?

由于这个问题的答案可能不是二元的,在做出这样的决定时应该考虑哪些因素?

c++ winapi condition-variable c++11

5
推荐指数
1
解决办法
828
查看次数