current position:Home>Decipher the password and there is no result after running?
Decipher the password and there is no result after running?
2022-02-02 18:33:20 【CSDN Q & A】
######
#include <stdio.h>int main(){ int i,j; char a[20]; for(i=0;a[i]='\n';i++) { scanf("%c",a[i]); break; } for(j=0;j<=i;j++) { if(a[j]<='z'&&a[j]>='a'||a[j]<='Z'&&a[j]>='A') a[j]=a[j]+4; } for(j=0;j<=i;j++) printf("%d",a[j]); return 0; }
Run without result
My solution ideas and tried methods
Can output the results correctly
Refer to the answer 1:
For reference :
#include<stdio.h>int main(){ char a[256]; int i = 0; while ((a[i] = getchar()) && a[i] != '\n') { if (a[i] >= 'A' && a[i] <= 'Z') a[i] = (a[i] - 'A' + 4) % 26 + 'A'; else if (a[i] >= 'a' && a[i] <= 'z') a[i] = (a[i] - 'a' + 4) % 26 + 'a'; i++; } a[i] = '\0'; printf("%s\n", a); return 0;}
Refer to the answer 2:
Refer to the answer 3:
#include <stdio.h>int main(){ int i,j; char a[20]; for(i=0;;i++) { // Input to add & scanf("%c",&a[i]); if(a[i]=='\n')break; } // the last one a[i] It's line breaking , So the subscript should be [0,i-1] i = i-1; for(j=0;j<=i;j++) { // If it is beyond the range of letters, start from the beginning if(a[j]<='z'&&a[j]>='a') a[j]='a' + (a[j]-'a'+4)%26; else if(a[j]<='Z'&&a[j]>='A') a[j]='A' + (a[j]-'A'+4)%26; } for(j=0;j<=i;j++) // For output characters %c printf("%c",a[j]); return 0; }
Refer to the answer 4:
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021833186679.html
The sidebar is recommended
- Appium code failed to open mobile app
- About the problems of C language 2022 calendar event recording system! (development tool eclipse)
- Restart Ubuntu as soon as VMware starts
- The computer network is normal, but some web pages can't be opened. What should I do
- Why can't you query after adding information
- The reinstallation system has been stuck in "starting windows"
- How did my visual studio code change like this
- Alien project spacecraft collision error
- Opencv play nine palace game
- What library does spider need to add? Why doesn't Anaconda
guess what you like
-
Why not exchange? C language pointer
-
There is a problem with my SQL statement
-
First establish the input data into a binary sort tree, and then find the data. Enter the keyword sequence (63, 90, 70, 55, 67, 42, 98, 83, 10, 45, 58). 1. Establish a binary sort tree according to the order of the entered keywords.
-
Why is x output 13 instead of 3
-
Python code, interface problems
-
Python basic problems, read and write files, and solve them in a basic way
-
CSDN article reading statistics algorithm logic
-
Swift5 dynamically obtain the height of the navigation bar and status bar
-
A small problem about string []
-
Why is it not displayed in graphicsview
Random recommended
- MATLAB image hiding problem, please help
- Python fastobjectlistview cannot operate on setitem * *
- What should I fill in at the crosswalk
- College C language programming c + + Programming
- Appium + Python + Android JDK failed to connect to the mobile phone to run app
- I think the activity can be started in the background above Android Q. how to realize it
- Use the predict type parameter to define a method for filtering books
- Problems related to the use of C PropertyGrid
- How to set the gain & lt^ u
- Click one H5 item in the app to jump to another H5 item
- Find a solution to the error of this r code
- Python will test Put the PY file in a python package (such as D: \ TT), import the package test in test2, and output the value of the variable data.
- When using PPO strategy to train reinforcement learning model, how to evaluate the quality of the model and judge whether it converges?
- Calculate the number of uppercase letters, lowercase letters and numbers in any string
- If you work from home, the same operation will fail
- Content encapsulation under three-level classification of Java
- The idea switches branches and the project directory structure disappears
- 1. Customize a - function to realize the following functions: input the accuracy e, and use the following formula to calculate the approximate value of cosx until the absolute value of the last - item is less than E. It is required to define and call the
- Find its Huffman code? Give the coding process and coding results (please give the large probability as 1 and the small probability as 0) Calculate the average code length. Calculate the compression ratio before and after coding
- C language and documents to solve students' performance problems
- C language file encryption applet problem
- Three types of MPEG images
- How to write this program code
- Questions about data structure: data structure sequence table (language-c language)
- A problem of energy economics
- Vscode why does Python have two problems when the external window is running? Press any key to continue?
- Using 7474n to build JK Trigger and D trigger.
- C language two-dimensional array, for interpretation
- When simulating with botu and factory IO, factory IO I2 The contacts behind 0 are not working
- How to solve termux qqbot error?
- C + + getline cannot correctly read the console input Chinese
- Android development bookkeeping
- About the problem of C language: input 12 + 3 with DEVC + + to get 12.000000. I don't know what's wrong, include & lt; stdio. h&gt;
- Prompt the user to enter an integer n and N real numbers, calculate and output the sum of the negative numbers in the input n real numbers.
- Using C52 and LCD1602 to simulate an electronic clock, how to program four modes and one LED flashing for four keys
- Do any friends know how to do this? Please
- For problems occurred during GCN reproduction, it is suggested that the openposedemo file cannot be found
- TypeError: string indices must be integers
- I really can't find answers to the exercises after freshman class.
- How is the MSE value compared with the vector?