#include <iostream>
#include <cctype>
#include <string>

const int Max = 5;

int main(int argc, char const *argv[]) {

  using namespace std;

  int golf[Max];
  int i;
  for (i = 0; i < Max; i++) {
    std::cout << "round #" << i+1 << '\n';
    while (!(cin >> golf[i])) {
      cin.clear();
      cin.get();
      // while (cin.get() != '\n') {
      //   continue;
      // }
      std::cout << "please enter a number:" << '\n';
    }
  }
  double total = 0.0;
  for (i = 0;i < Max; i++) {
    total += golf[i];
  }
  std::cout << total << '\n';


  return 0;
}

 

 

int vector_begin(){
    vector<string> words;
    string str;
    cout << "please input you content==>:" << '\n';
    while (cin >> str){
        words.push_back(str);
        if (cin.get() == '\n'){
            break;
        }
    }

    vector<string>::iterator iter;

    for (iter =words.begin(); iter != words.end(); iter++){
        cout << *iter << '\n';
    }

    return 0;
}


int main () {
//    assign();

    vector_begin();
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-09-09
猜你喜欢
  • 2021-08-24
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-04-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案