Add a sentinel command to stop the loop

Assignment Help C/C++ Programming
Reference no: EM13162688

 add a sentinel command to stop the loop. When the program is compiled, It'll ask the user to type in a palindrome. I want the user to type EXIT to end the loop. 

 

#include <iostream>

#include <fstream>

#include <cstring>

 

 

using namespace std;

 

int main(void)

{

char word[81];

do

{

bool palindrome=true;

 

cout << "Please enter a word" << endl;

cin>>word;

int length = strlen(word);

for (int i=0; i<length; i++)

{

word[i] = toupper(word[i]);

}

int(length/2);

if (length>0)

{

for(int i=0;i<(length);i++)

{

if(word[i]!=word[length-1-i])

palindrome=false;

}

}

 

if(palindrome==true)

{

cout << "The word is a palindrome" << endl;}else{cout << "The word is not a palindrome" << endl;  }}while(word=="END");return(0) ;  } 

 

Reference no: EM13162688

Questions Cloud

Difference between cyber crimes and cyber-related crimes. : Summarize the difference between cyber crimes and cyber-related crimes. On cyber crimes, define cyber trespass, cyber privacy and cyber vandalism. On cyber-related crimes explain the difference between cyber-assisted and cyber-enhanced crimes.
Draw a production system : Suppose that you must perform three tasks, X, Y, and Z. You can only do one task at a time, and once that task is done, you never redo it.
Reverses the characters in a character array : Write the function reverseit that reverses the characters in a character array. You must also write main that calls reverseit.
Write a program to accept a number representing : Write a program to accept a number representing how many first names the user willenter from the command line (5 names maximum), and the actual first names, fromthe command line. Create an array dynamically that has the same size as number ofnames.
Add a sentinel command to stop the loop : add a sentinel command to stop the loop. When the program is compiled, It'll ask the user to type in a palindrome. I want the user to type EXIT to end the loop.
Required value for the move command : Shape_index is a required value for the move command. It is the index of the shape in the shape data arrays that you wish to move. It should range between 0 and MAX_SHAPES - 1. Be sure to validate the index.
Write a function that takes a list of integers as argument : Write a function that takes a list of integers as argument and returns a pair consisting of the sum of the even positions and the sum of the odd positions of the list. You should not use any auxiliary functions.
Receiver decide which symbol was originally sent : How can a receiver decide which symbol was originally sent when a received "point" lies somewhere in between other points in the diagram?
Program to translates a number into the closest letter grade : Write a program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write program which reads n numbers from keyboard

Write down C++ program which reads N numbers (positive, negative, integer and double numbers) from keyboard, computes and shows the following information. Largest number of all numbers entered from keyboard.

  Project

Unit 3 Individual Project SSCI210 – 1304B – 01 A typical individual who commits who commits hate crimes whether it is against or aimed at the Gay/lesbian community , the persons of color or the Jewish community, ( I mention these three because they a..

  Determine order in which constructors of class will execute

Suppose that an object of class three enters its scope, so the constructors of theses classes will execute. Determine the order in which the constructors of these classes will execute.

  Create if-then statement with single alternative decision

Create the If-Then statement (or a flowchart with a single alternative decision structure) which assigns 20 to  variable y and allots 40 to variable z if variable x is greater that 100.

  Pointer variables to demonstrate shallow and deep copy

Using C++, write a program that uses pointer variables to demonstrate shallow and deep copy. The program should give the user the choice to do the following:

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Write a c program that asks for and reads in two integers

Write a C program that asks for and reads in two integers and then reports if one is a multiple of the other.

  Write application to calculate price of carpeting for room

The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms.

  Demonstrate the construction and output of an array

In fluid mechanics, the Reynolds number (Re) is a dimensionless quantity that is used to help predict similar flow patterns in different fluid flow situations. For example, Reynolds numbers can be computed for different velocities of fluid flow over ..

  Prepare an accounting for a dorm''s kitchen

The "purpose" of the program is to prepare an accounting (database) for e.g. a dorm's kitchen, to keep track of the consumption of beer for each room.

  Give students practice in writing and calling their function

To give students practice in writing and calling their own functions. To give students practice in implementing and planning complex programs.

  Write a very basic doubly-linked list

CptS 122 Lab #2: Linked Lists ,  Along with vectors, linked lists are one of the fundamental data structures in computer science. Unlike vectors, which store information in a contiguous block of computer memory, linked lists have the potential to sto..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd