In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "Java how to calculate the number of characters", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "Java how to calculate the number of characters" bar!
1. Topic description
Write a program that accepts a string of letters and numbers and spaces, and a character, and then outputs the number of characters in the input string. Case insensitive.
Enter a description:
Enter a string of letters and numbers and spaces, and a character.
Output description:
The number of characters in the output input string.
Input example:
ABCDEFA
Examples of output:
13. Code scheme 1
Basic idea: define String, Char variables-- through getline, cin input variables-- traverse the String array for comparison-- output count.
/ / suitable for any character input # include#include using namespace std; int main () {string inputString; char inputChar; getline (cin,inputString); / / getline reads characters from the standard input device and returns them to the input stream cin, where the data is bound to the variable inputString cin > > inputChar; / / scanf ("% c", & inputChar) / / the above are two ways of input: cin and scanf () int count=0; for (int item0
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.