Skip to content

Commit

Permalink
created a continous integration yml file, added condition to exclude …
Browse files Browse the repository at this point in the history
…done, and replace cin with getline, closes ChicoState#2
  • Loading branch information
nrakocevic committed Sep 25, 2024
2 parents 37a3383 + fdf326f commit bf94f63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Build C++

on:
merge:
branches: [ main ]
pull_request:
branches: [ main ]

Expand Down
13 changes: 9 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ using std::cout, std::cin, std::endl, std::string, std::vector, std::getline;

int main(){
string input = "";
vector<string> list;
vector<string> favorites;

do{
if( list.size() == 0 ){
if( favorites.size() == 0 ){
cout << "What is your favorite?\n";
}
else{
cout << "What is your next favorite?\n";
}
<<<<<<< HEAD
getline(cin, input);
if (input != "done")
list.push_back(input);
=======
cin >> input;
favorites.push_back(input);
>>>>>>> refs/remotes/origin/main
}while( input != "done" );

cout << "Your favorite list:\n";
for(int i = 0; i < list.size(); i++){
cout << list.at(i) << endl;
for(int i = 0; i < favorites.size(); i++){
cout << favorites.at(i) << endl;
}

return 0;
Expand Down

0 comments on commit bf94f63

Please sign in to comment.