Answer to Question #258109 in C++ for Dianne

Question #258109
Create a program will ask the user to enter an integer number and a string if the integers number is oddprint the string words that the user enter and if the integers number is even print the even numbers with the string words this is an even number.
1
Expert's answer
2021-10-28T07:11:16-0400
#include <iostream>

using namespace std;

int main()
{
  int var;
  string s;
   
  std::cout << "enter integer number\n";

  std::cin >> var;
   
  std::cout << "enter string\n";

  std::cin >> s;
   
  if (var % 2)
    std::cout << s << "\n";
  else
    std::cout << var << " - this number is even";
    ;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS