TO BE WRITTEN IN C FORMAT THANK YOU NOTE In order to do this
TO BE WRITTEN IN C++ FORMAT. THANK YOU.
NOTE:
In order to do this lab, you will have to count the number of times an output has been put to the screen. Simple do this by something like this:
counter = 0;
(some other code)
if (condition) {
cout << \"whatever\";
counter++; // or counter = counter + 1
}
etc.
Note that you will need to add \"counter < 2\" in your conditions (at appropriate spots) in order to make sure that you don\'t display too many.
Solution
#include <iostream>
using namespace std;
int main()
{
int counter = 0;
while (counter < 2) {
cout << \"whatever\";
counter++; // or counter = counter + 1
}
cout<<endl;
return 0;
}
Output:
sh-4.2$ g++ -o main *.cpp
sh-4.2$ main
whateverwhatever
