For requesting c++ mini program using only if-else, loops, functions, and arrays, without class.

Sep 7, 2019 at 5:23am
Please, can someone give me a c++ mini-program using only if-else, loops, functions, and arrays?
Last edited on Sep 7, 2019 at 6:55am
Sep 7, 2019 at 5:27am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

void lazyGit(const char *message) {
  while ( *message ) {
    cout << *message++;
  }
}
int main()
{
  char doMyHomework[] = "No\n";
  if ( doMyHomework )
    lazyGit(doMyHomework);
  return 0;
}
Sep 7, 2019 at 5:28am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <cctype>
#include <limits>

int main()
{
   std::cout << "Do you want someone to do all the work for you? ";
   char answer { };
   std::cin >> answer;

   std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

   if (std::toupper(answer) == 'Y' ) { std::cout << "Post it in the Jobs section.\n"; }
}
Topic archived. No new replies allowed.