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

Emotional and Psychological Trauma

What is Emotional and psychological trauma ? Emotional and psychological trauma is any stressful event that occurs in a lifetime that makes you struggle with your emotions, memory,different activities and make you feel helpless and hopeless in this ruthless world. The event may not be objectively scaled it is a subjective sensation about a event and every individual respond differently to the event . For example a death in a family due to accident due to an pothole makes one dad react positively and he goes on to correct every pothole of the city and some other may react it negatively Emotional and psychological trauma can be caused by: In Indian scenarios emotional and psychological trauma can be caused by accident,disasters, sexual assault that may have occurred at any course of life Ongoing family issues, neighbourhood problems , continues rejection from various interviews , household violence , neglect, low performance at school or institution, contin...

Sugar is The New Oil

    Do you know we all believe that it is the fat in the diet which makes us chubby.      In response to it we had tried cutting short of the oils in our diet right ?      Now introspect how many of you had been successfull in attaining your goals by reducing the amount of fats in the diet .      Here comes the concept of sugar being the new oil ...      Majority of us are on diet which contains large amount of carbohydrates that breaks down to glucose and get absorbed into the intestines.      In response to the increased glucose in the blood the pancreas releases insulin which makes sure that the glucose which was absorbed gets utilised by the muscles, liver and other body organs .      Now you would have thought that what’s wrong in that?      The diet not only contains the carbohydrates it also contains fats and protein in it which are also absorbed in the intestin...

Capstone Work: Experience setting up LAMP Infrastucture

    The “L” of the LAMP stack is achieved by instantiating an Ubuntu server on the Azure platform. By and large this process is straight-forward and follows the Azure provided instructions. As this is documented in Microsoft documentation, this will not be reproduced here.     In our tests, we chose an Ubuntu 18.04 image and deployed it on a Standard B1ms (1 vcpus, 2 GiB memory) virtual machine. We chose the B1ms VM because the B-series VMs seem to provide “burstable performance” (Shimanskiy & Hughes, 2020). Here is an excerpt of the Microsoft Document on the B-series VMs:     Part of the challenge of using the Azure platform is that we had to be very deliberate in the chosen specifications relating to VMs as these decisions will have financial impacts. Azure offers various sizes of General Purpose, Compute-Optimized, Storage-Optimized, Memory-Optimized, GPU, and High Performance Compute VMs. As our web server did not require any ...