如何确保用户的输入是否为整数

时间:2019-10-07 12:19:31

标签: c++

@override
Widget build(BuildContext context) {
  return MaterialApp(
    debugShowCheckedModeBanner: true,
    home: Scaffold(
    body: FutureBuilder(
      future: 
      builder: (context, snapshot) {
        if (snapshot.hasData()) {
          return Text(snapshot.data[2].category[1].genre1),
        }
        return CircularProgressIndicator();
      }
    )
    appBar: AppBar(
      title: Text('movie schedules'),
      ),
    ),
  );
}

1 个答案:

答案 0 :(得分:-1)

  

现在,在这里如何检查用户输入是否为整数?

if(!(std::cin >> howMany))
    throw std::runtime_error("failed to read or parse 'howMany'").