Skip to content

Commit

Permalink
Create New C++ file (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekSushan authored Dec 12, 2023
1 parent d7d7b44 commit 38c566d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions C++/ofekSushan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
#include <string>
using namespace std;

int main()
{
bool replace = false;
string coffee = "coffee";
cout << coffee << endl;
for (int index = 0; index < coffee.size() - 1; index++)
{
if (!replace && coffee[index] == 'f')
{
coffee[index] = 'd';

replace = true;
}
else if (coffee[index] == 'f' || coffee[index] == 'e')
{
coffee.erase(index, 1);
index--;
}
}

cout << coffee << endl;

return 0;
}

0 comments on commit 38c566d

Please sign in to comment.