anyone please help immediately
thank you.

Create a flowchart which shows the logic required to ask the user to input a word, check its length and output one of two messages depending on its length. If it is longer than 8 characters, “It’s a long word” should be outputted, otherwise “It’s a short word” should be outputted

Respuesta :

Following are the program and the flowchart description to the given question:

Program Explanation:

  • Defining header file.
  • Defining the Main method.
  • Defining an string variable "str" and an integer variable "x".
  • Using x variable that holds length of string.
  • Using a conditional statement that checks x value greater than 8, when the condition is true it will print "It's a long word", otherwise it will print "It's a short word".

Program:

#include <iostream>//header file

#include <string>//header file

using namespace std;

int main() //main method

{

   //defining variables

 string str;//string

 int x;//integer

 cin>>str;//input string value

 x=str.length();//using integer variable to hold length

 if(x>8)//using conditional statement to check length is greater than 8

 {

   cout <<"It's a long word";//print string value

 }

 else

 {

   cout <<"It's a short word";//print string value

 }

 return 0;

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/20131960

Ver imagen codiepienagoya
Ver imagen codiepienagoya
ACCESS MORE