当前位置:网站首页>Integer reverse output of C language test question 166
Integer reverse output of C language test question 166
2022-06-09 22:18:00 【Maserati】
Personal home page : Personal home page
Series column :C Language test questions 200 example
Recommend a brush algorithm 、 written examination 、 Face the 、 Nada Corporation offer Artifact Click jump to enter the website
Author's brief introduction : Hello everyone , I'm Maserati ,CSDN Blogger ( Ranking of the whole station Top 50), Alibaba cloud blog expert 、51CTO Blogger 、 Huawei cloud sharing expert
1、 subject
subject : Store an integer entered from the keyboard into an array , The integer is output in the reverse order of the array through the operation of the program , Use recursive methods to solve problems .
analysis :
Design functions to store data in reverse order , Set the address where the formal parameter array receives the argument array , To store every bit of data . The function body solves the problem recursively , So consider the conditions for recursion . for example , The data n Store in array s in , if n It's one digit. , Then store n To array ; if n Not a single digit , Then store n/10 To array .
The difficulty in solving the problem lies in finding the storage address of the data , By constantly taking remainder and dividing 10 Get every bit of data . In order to store data in reverse order , Every division 10 When , At the same time, the address of the array where the data is stored is moved back , The first digit thus obtained is stored in the last digit of the array …… By moving forward one by one , Recursive regression , Realize the storage of the whole data . By function convert() Realize the reverse conversion of numbers in the string .
边栏推荐
- Intelligent prevention and control of safety production risk at construction site in flood season
- 健身是什么?
- List of resources of yimai.com development interest buying project 0605
- Basic use of WinForm programming control treeview tree view 20220527
- Slightly more complex queries
- 202206007 Simulation Competition summary
- After several twists and turns, how long can the TSDB C-bit of incluxdb last?
- 86.(leaflet之家)leaflet军事标绘-直线箭头采集
- Lidar related introduction
- Introduction to startup of spider PI intelligent vision hexapod robot 0602
猜你喜欢

Digital integrated management system of double prevention system in chemical enterprises

FPN-Feature Pyramid Network

C语言试题164之求定积分

spider pi 智能视觉六足机器人 vnc连接机器人 0603

Campus Ruijie router User Guide

数据库每日一题---第7天:订单最多的客户

TL,你是如何管理项目风险的?

MATLAB实现Pettitt突变检验

Audio 3A processing practice makes your application more "pleasant"

建筑工地数字化监管和科学战疫的智慧力量
随机推荐
邦纳光电开关SM912LVQD
FPN-Feature Pyramid Network
SPIDER Pi Intelligent Vision hexapode Robot VNC Connect Robot 0603
[translation paper] a progressive morphological filter for removing nonground measurements from airport lidar dat
华为设备配置Hub and Spoke
Slightly more complex queries
Database daily question - day 7: customers with the most orders
C语言试题168之获取矩阵的最大值及其下标
RCNN系列总结
node. JS connecting sqlserver encapsulating MSSQL
Second cloud cloud's original fully compatible solution for information innovation promotes the acceleration of the implementation of information innovation industry
MySQL的集合运算
ST-Link V2 下载出现:internal command error&Error: Flash Download failed - Target DLL has been cancelled
Huawei cloud zero code development image compression tool
Cremb Pro backend sub administrator 403 problem analysis
第四范式陈雨强:企业智能决策的下一代技术「强化学习 + 环境学习」
浅谈倍增法求解LCA
2022安全生产月活动启动安全生产与疫情防控两手抓
Audio 3A processing practice makes your application more "pleasant"
NPM and yarn