Skip to main content

Sentinel Controlled Loops


https://i.ytimg.com/vi/eSYeHlwDCNA/maxresdefault.jpg


Instructions:

    Write a program that will have the user enter a letter.
  • If the letter is a vowel, the output will report that the user has entered letter ??? and that it is a vowel.
  • Otherwise, the output will report that the user has entered letter ??? and asks them to please enter a vowel.
  • The program will run until the user enters x.
  • The user may enter the letter in either uppercase or lowercase and the program will execute properly.
  
Solution:


#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main()
{
char ch, tmpCh;
printf("*********Welcome to Program**********\n");
printf("Enter the Char: \n");
scanf(" %c", &ch);
tmpCh = (toupper(ch));
while (tmpCh != 'X')
{
if (!isalpha(ch) || (int)ch == 45)
{
printf("Please Enter Valid Char.\n");
printf("\nPlease press any key to continue: ");
char reCh;
reCh = getc(stdin);
if (reCh == 10)
{
reCh = getc(stdin);
}
system("clear");
printf("*********Welcome to Program**********\n");
printf("Enter the Char: \n");
scanf(" %c", &ch);
tmpCh = (toupper(ch));
}
else
{
if (tmpCh == 'A' || tmpCh == 'E' || tmpCh == 'I' || tmpCh == 'O' || tmpCh == 'U')
{
printf("You have enter Valid Vowel which is %c \n", ch);
printf("\nPlease press any key to continue: ");
char reCh;
reCh = getc(stdin);
if (reCh == 10)
{
reCh = getc(stdin);
}
system("clear");
printf("*********Welcome to Program**********\n");
printf("Enter the Char: \n");
scanf(" %c", &ch);
tmpCh = (toupper(ch));
}
else
{
printf("You have enter letter which is not Vowel which is %c \n", ch);
printf("\nPlease press any key to continue: ");
char reCh;
reCh = getc(stdin);
if (reCh == 10)
{
reCh = getc(stdin);
}
system("clear");
printf("*********Welcome to Program**********\n");
printf("Enter the Char: \n");
scanf(" %c", &ch);
tmpCh = (toupper(ch));
}
}
}
return 0;
}

Comments

  1. Nicely use toupper() function to cover forth step

    ReplyDelete
  2. The welcome supply goes a lot as} $7,500 should 카지노사이트 you use crypto, and we additionally suggest trying out the Rewards Program and the VIP section. It's easy - you play games, and you earn bonus points for extra goodies and perks. This on-line on line casino is mobile-friendly, however we now have a minor quibble with the exclusion of some of the the} slots within the cellular version.

    ReplyDelete
  3. Great blog ! I am impressed with suggestions of author.
    Organic Clothing

    ReplyDelete

Post a Comment

Thanks

Popular posts from this blog

Are You Prepared Against Cyber Threats?

What is the worth of information Security in 21 st century? Imagine small or medium scale business having around 2500-4000 employees working. What if there is a data bridge of small or medium scale compony? Information carries by Venture are employees’ names, Address, Banking Forms, Tax forms which also includes Social incurrence Number and their dependents names and supporting information which may be sell or used for personal blackmails by intruders which was kind of storyline of Scotty’s Holdings data bridge [1] . Main base of this data bridge was email phishing which were send to all over compony employee pretending to be CEO. Which contains Employer identification number (EIN), Employer’s name, address, and ZIP code, Wages, tips, other compensation and many more fields. But it’s not the first or last compony to be a part of Email phishing Attack. Main purpose of Email Phishing scams is stealing banking credentials or any other form of credentials. Preventions Employer and Emp...

IMPULSE CAPTURE CAMERA Overview Part-1

  Objective The Android camera platform designed in this project can turn its direction Manually using Button. If a person claps hands, then it will Detect and Impulse and capture the Moment this Device will capture multiple photos if more than one claps detected. It will not only detect clap sound it can detect any kind of noise and starts capturing the photos. The system which we have detected can distinguish between n oise and impulse sound.    Motivation When we travel alone, it can be inconvenient to take pictures with yourself in it. Often, we have to hold the camera with our hands and capture a close photo with barely background. In a better case, we still need to pre - set a short timer, which requires us rushes back from the camera. Therefore, we came up with platform that uses microphones to detect clap direction and ATmega 32 microcontroller with servo motor to control the camera and earpod t o shutter. This design makes selfie much more easier and convenient ...

Education is an Key Inventory of Life

     There are different Definitions for Education in Society and Social Science. According to Marxist, Purpose of Formal Education is “the transmission of certain attitudes, knowledge and skills to the members of a society through formal systematic training”. Education is immensely important in the 21st Century, but it’s not necessary for someone to become successful and earn more money. However, Education plays vital roles in getting white collar job with good wages in co-operate worlds. Money can bring fame but Education is required to maintain fame gained over the time. Which leads to Moral learnings we learned in elementary to high school. Most basic learnings we gained from our elementary schooling is how to respect the elders and behave with them. As we grew up we practiced those moral values in our day-to-day life while attending meetings, helping the needy community during the crisis like COVID-19 pandemic. One should take inspiration from Ratan Tata chairperson ...