1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gregori [183]
3 years ago
12

Why is the given C++ program is not working?

Computers and Technology
1 answer:
Jobisdone [24]3 years ago
3 0

Answer:

Please find the edited program below:

#include<iostream>

#include <stdio.h>

using namespace::std;

int main()

{

char ch;

cout<<"Enter any letter: ";

ch=getchar();

if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u'|| ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')

cout<<"Vowel";

else

cout<<"Consonant";

return 0;

}

Explanation:

We cannot input char type using cin, we need to use getchar, and it is under header file stdio.h. Also, for comparing we need to use == and not =. And corrrect way of including std is using namespace::std;

You might be interested in
#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
lara [203]

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

5 0
3 years ago
Possible consequences for plagiarism, listed in CAVA's Academic Integrity Policy, may include:
Ahat [919]

CAVA’s Academic Integrity Policy refers to Calfornia Virtual Academic’s policy book for students of their schools, which are public charter schools in the state of California.

In the handbook, it is mentioned that students who commit plagiarism will be required to re-submit the assignment during the first offence; will receive a fail grade for the assignment during the second offence; and will be withdrawn from a course or even the school during the third offence.

Thus the answer to the question is (D) all of the above.

8 0
3 years ago
When working in excel online, which of the following is considered a conditional formula?
Alika [10]
B. Because conditional statements have an IF before stating the condition
8 0
3 years ago
Read 2 more answers
A company ABC asked you to design a simple payroll program that calculates and employee's weekly gross pay, including any overti
julsineya [31]

Answer:

<em>C++.</em>

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////

int main() {

   int weekly_hours = 0;

   int hourly_rate;

   float gross_pay = 0;

   cout<<"Enter weekly hours worked: ";

   cin>>weekly_hours;

   

   cout<<"Enter hourly rate: ";

   cin>>hourly_rate;

   

   cout<<endl;

   ////////////////////////////////////////////////

   if (weekly_hours > 40) {

       gross_pay = (weekly_hours*hourly_rate) + ((weekly_hours*hourly_rate)*0.5);

   }

   else

       gross_pay = weekly_hours*hourly_rate;

       

   cout<<"Weekly gross pay: $"<<gross_pay;

   ////////////////////////////////////////////////

   return 0;

}

3 0
2 years ago
The safest action to take if someone claiming to be from your banks calls you to ask for account information is to
aalyn [17]
<h2>Answer:</h2>

<u>The correct option is</u><u> (B) hang up and call back using the banks official phone number</u>

<h2>Explanation:</h2>

There are a lot of cases where people pretend to call from the banks where the receivers have the account. The caller tries to take the information from the receiver and pretends to be the bank official. If there is any doubt then the receiver should hang up the call and call back the official number of the bank to confirm that whether somebody has called from the bank to get the information.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Does anyone have game design in connections
    13·1 answer
  • Which of the following illustrates an example of a Boolean data type?
    15·1 answer
  • which of these describe raw data?check all of the boxes that apply A) what a person buys B) where a person lives C) data that ha
    9·1 answer
  • Rainfall_mi is a string that contains the average number of inches of rainfall in Michigan for every month (in inches) with ever
    12·1 answer
  • What is application software used for
    13·1 answer
  • Which file system is designed to verify and autocorrect data faults on the volume without having to bring the volume down for ma
    11·1 answer
  • What is wrong with the following C++ code? How would you fix it? int sum; for (int i=0; i&lt;1000; ++i) sum += i; { printf("Sum
    5·1 answer
  • What type of network would be suitable for linking all computers in a building
    6·1 answer
  • How do you access the <br><br>internet in your school and at home?​
    11·1 answer
  • Which of the following recommendations should you follow when placing access points to provide wireless access for users within
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!