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
Design a circuit that has a 3-bit binary input B2, B1, B0 (where B2 is most significant bit and B0 is least significant bit) and
jenyasd209 [6]

Isn't this circuit just a wire, where Z=B0?

3 0
3 years ago
Each web site contains a(n) ____ page, which is the first document users see when they access the site.
katrin2010 [14]
Home is the answer. Hope this helps. :)
7 0
3 years ago
Write code to take a String input from the user, then print the first and last letters of the string on one line. Sample run: En
Ainat [17]
<h2>Answer:</h2>

//import the Scanner class to allow for user input

import java.util.Scanner;

//Begin class definition

public class FirstAndLast{

   //Begin the main method

    public static void main(String []args){

       

       

       //****create an object of the Scanner class.

       //Call the object 'input' to receive user's input

       //from the console.

       Scanner input = new Scanner(System.in);

       

       //****create a prompt to tell the user what to do.

       System.out.println("Enter the string");

       

       //****receive the user's input

       //And store it in a String variable called 'str'

       String str =  input.next();

       

       //****get and print the first character.

       //substring(0, 1) - means get all the characters starting

       //from the lower bound (index 0) up to, but not including the upper

       //bound(index 1).

       //That technically means the first character.

       System.out.print(str.substring(0,1));

       

       //****get and print the last character

       //1. str.length() will return the number of character in the string 'str'.

       //This is also the length of the string

       //2. substring(str.length() - 1) - means get all the characters starting

       // from index that is one less than the length of the string to the last

       // index (since an upper bound is not specified).

       // This technically means the last character.

       System.out.print(str.substring(str.length()-1));

       

       

       

    }  // end of main method

   

} //end of class definition

<h2>Explanation:</h2>

The code has been written in Java and it contains comments explaining important parts of the code. Kindly go through the comments.

The source code and a sample output have also been attached to this response.

To run this program, copy the code in the source code inside a Java IDE or editor and save it as FirstAndLast.java

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
4c53f66d970acf88b251b2cf41bcdaf6.png
3 0
2 years ago
This is not a factor that you should use to determine the content of your presentation. Your audience your goals your purpose yo
aksik [14]

Your technology I believe

4 0
3 years ago
Read 2 more answers
Which of the following actions should you take when turning left at an intersection?
fomenos
The answer is B Okay good luck and dont...mess it up
8 0
3 years ago
Other questions:
  • A. True
    6·1 answer
  • When purchasing a(n) ________ computer, having cellular as well as wifi can be important?
    9·1 answer
  • Professional photographers often use the lowest quality settings on their cameras since this can be reversed in Photoshop.
    7·2 answers
  • Trina Hauger works for Johnson Electric as a corporate lawyer, and part of her duties are to ensure the ethical and legal use of
    13·1 answer
  • What is the purpose of a career portfolio?
    6·1 answer
  • Why do we use a design process?
    13·2 answers
  • What is the output?
    12·1 answer
  • Which statement about intellectual property is true? (CSI-7.6) Group of answer choices It is okay to use code you find on the in
    14·1 answer
  • Activity Sheet 2<br>A.Illustrate how to create the object below using draw and modify commands.​
    15·1 answer
  • Disadvantages of a grain crusher
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!