In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to understand the atoi function in C++, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
I. atoi function
In stdlib.h, the atoi function can be used to convert char strings to int integers.
The syntax is as follows:
/ * * description: convert a char type to an integer * * Parameter: * [in] string: string type * * return value: return the integer * / int atoi (char * string) corresponding to the char type II. Atoi function practice / / @ Author: ape programming / / @ Blog (personal blog address): www.codersrc.com//@File:C language tutorial-C atoi + atoi function wchar_t conversion / / @ Time:2021/08/10 08:00//@Motto: do not accumulate steps to reach thousands of miles, do not accumulate small streams can not become rivers and seas, program life needs to unremittingly accumulate! / * / # include "stdafx.h" # include # include "windows.h" # pragma warning (disable: 4996) int _ tmain (int argc _ TCHAR* argv []) {printf ("atoi function calculation result% d\ n", atoi ("13456")) Printf ("atoi function calculation% d\ n", atoi ("0"); printf ("atoi function calculation% d\ n", atoi ("789")); printf ("atoi function calculation% d\ n", atoi ("123.123")); / / default to integer printf ("atoi function calculation% d\ n", atoi ("- 9")); system ("pause") Return 0;}
Output:
The calculation result of atoi function is 13456
The calculation result of atoi function is 0
Calculation result of atoi function 789
The result of atoi function calculation is 123
Calculation result of atoi function-9
Please press any key to continue. . .
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.