Вопрос задан 10.05.2019 в 09:43. Предмет Информатика. Спрашивает Дулинец Александр.

Дан символ, написать программу выводящую на экран его код! Дан код символом написать программу

которая выводит сам символ! Написать программу для вывода на экран всех маленьких латинских букв( по алфавиту), а заглавные латинские буквы в обратном порядке! Дано целое число N , написать программу выводящую на экран N1 маленьких латинских букв
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Хайруллина Лейсан.
#include <iostream>

int main(){
  //1
  char ch;
  std::cin >> ch;
  std::cout << int(ch) << std::endl;

  //2
  int c;
  std::cin >> c;
  std::cout << char(c) << std::endl;

  //3
  for (char ch = 'a'; ch <= 'z'; ch++)
    std::cout << ch;
  std::cout << std::endl;

  for (char ch = 'Z'; ch >= 'A'; ch--)
    std::cout << ch;
  std::cout << std::endl;

  //4
  int v;
  std::cin >> v;
  for (char ch = 'a'; v > 0; v--){
    if (ch > 'z') ch = 'a';
    std::cout << ch++;    
  }

  return 0;
}
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to output the code of a given character

To write a program that outputs the code of a given character, you can use the ASCII or Unicode values of the characters. Here's an example program in Java that takes a character as input and prints its code:

```java import java.util.Scanner;

public class CharacterCode { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter a character: "); char ch = scanner.next().charAt(0); int code = (int) ch; System.out.println("The code of the character " + ch + " is " + code); } } ```

You can run this program and enter a character to see its code. For example, if you enter the character 'A', the program will output "The code of the character A is 65". The code 65 corresponds to the ASCII value of the character 'A'.

Program to output the character represented by a given code

To write a program that outputs the character represented by a given code, you can use the ASCII or Unicode values of the characters. Here's an example program in Java that takes a code as input and prints the corresponding character:

```java import java.util.Scanner;

public class CharacterFromCode { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter a code: "); int code = scanner.nextInt(); char ch = (char) code; System.out.println("The character represented by the code " + code + " is " + ch); } } ```

You can run this program and enter a code to see the corresponding character. For example, if you enter the code 65, the program will output "The character represented by the code 65 is A". The character 'A' corresponds to the ASCII value 65.

Program to output lowercase Latin letters in alphabetical order and uppercase Latin letters in reverse order

To write a program that outputs all lowercase Latin letters in alphabetical order and uppercase Latin letters in reverse order, you can use loops and the ASCII values of the characters. Here's an example program in Java:

```java public class LatinLetters { public static void main(String[] args) { System.out.println("Lowercase Latin letters in alphabetical order:"); for (char ch = 'a'; ch <= 'z'; ch++) { System.out.print(ch + " "); } System.out.println("\nUppercase Latin letters in reverse order:"); for (char ch = 'Z'; ch >= 'A'; ch--) { System.out.print(ch + " "); } } } ```

When you run this program, it will output all lowercase Latin letters in alphabetical order, followed by all uppercase Latin letters in reverse order. For example, the output will be:

``` Lowercase Latin letters in alphabetical order: a b c d e f g h i j k l m n o p q r s t u v w x y z Uppercase Latin letters in reverse order: Z Y X W V U T S R Q P O N M L K J I H G F E D C B A ```

Program to output N lowercase Latin letters

To write a program that outputs N lowercase Latin letters, you can use a loop and the ASCII values of the characters. Here's an example program in Java:

```java import java.util.Scanner;

public class NLowerCaseLetters { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the value of N: "); int N = scanner.nextInt(); System.out.println("Lowercase Latin letters:"); for (char ch = 'a'; ch < 'a' + N; ch++) { System.out.print(ch + " "); } } } ```

When you run this program and enter a value for N, it will output N lowercase Latin letters. For example, if you enter 5, the program will output "a b c d e".

I hope this helps! Let me know if you have any further questions.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос