Computer Science, asked by eswardora1995, 6 months ago

Write a program to accept a character (not a special character). Display the next

character accordingly​

Answers

Answered by Anonymous
1

// CPP program to find type of input character

#include <iostream>

using namespace std;

void charCheck(char input_char)

{

// CHECKING FOR ALPHABET

if ((input_char >= 65 && input_char <= 90)

|| (input_char >= 97 && input_char <= 122))

cout << " Alphabet ";

// CHECKING FOR DIGITS

else if (input_char >= 48 && input_char <= 57)

cout << " Digit ";

// OTHERWISE SPECIAL CHARACTER

else

cout << " Special Character ";

}

// Driver Code

int main()

{

char input_char = '$';

charCheck(input_char);

return 0;

}

Answered by Oreki
3

import java.util.Scanner;

public class NextCharacter {

   public static void main(String[ ] args) {

       System.out.print("Enter a character - ");

       char character = new Scanner(System.in).next( ).charAt(0);

       System.out.println(Character.isLetterOrDigit(character) ?

               "Next Character - " + ++character : "Special Character");

   }

}

Similar questions