c 。What will be returned by giving a number to the toupper. What will be returned by giving a numbe

Updated on technology 2024-05-21
15 answers
  1. Anonymous users2024-02-11

    #include

    #include

    void main()

    char x='a',y='a',z='5';

    If isdigit is used, %d should be used

    Debugging results. x=a,y=a,z=5

    x=0,y=0,z=4

    It can be concluded that the number toupper outputs a single character or that number, it can only convert lowercase to uppercase, uppercase or uppercase, while isdigit reads the ASCII code of a character, and it is the number that returns a non-zero value, not the number that returns zero. Both are in this library.

    Similarly, the isalpha() function determines whether the character ch is an English letter, and if it is an English letter, it returns a non-0 (2 for lowercase letters, 1 for uppercase letters). If it is not a letter, it returns 0; The tolower() function is the opposite of the toupper function, which is uppercase to lowercase, and both are also in the above library

  2. Anonymous users2024-02-10

    toupper is used to convert lowercase letters to uppercase letters, and will not output to numbers; isalpha is used to determine whether it is a letter or not, and it will return 0 when given a number

  3. Anonymous users2024-02-09

    str1 and str2 are both character pointers, so *str1 and *str2 are both characters.

    tolower is a function that turns characters into lowercase letters, i.e., makes the characters pointed to by str1 and str2 lowercase.

    The specific subtraction of two characters is the subtraction of their ASCII code values, for example'a' = 97, b='98'

    a'-'b' = -1

    ret = tolower(*str1) -tolower(*str2)) indicates whether str1 and str2 point to the same character (case-insensitive), the same is true, otherwise ret ! =0, i.e. not the same.

    ret = tolower(*str1) -tolower(*str2)) str2 is used to determine whether the foregoing is the same and whether the string of characters to which str2 points is terminated.

  4. Anonymous users2024-02-08

    Your selection doesn't solve your problem at all, it's obviously the answer to someone else's question.

    In fact, this example is very simple, you right-click tolower to go to the definition, you can see that the function prototype is: int toupper(int c), int tolower(int c), of course it will return the ascii corresponding to the character, the solution is very simple, is to cast it: (char)tolower(ch), the problem is solved.

  5. Anonymous users2024-02-07

    In the past, many character-related functions returned ints, and there seems to be no reasonable reason.

  6. Anonymous users2024-02-06

    Determine whether the character ch is an English letter, return 2 if it is a lowercase letter, and 1 if it is an uppercase letter. If it is not a letter, it returns 0;

  7. Anonymous users2024-02-05

    int isalpha(int ch);

    Determine whether the character ch is an English letter, return 2 if it is a lowercase letter, and 1 if it is an uppercase letter. If it is not a letter, it returns 0;

    #include

    #include

    int main()

    Run this program** and you can get the corresponding results.

  8. Anonymous users2024-02-04

    #include #include int wordsum(char* str); int numsum(char* str);void main() int wordsum(char* str) return total; }int numsum(char* str) return total; } begging.

  9. Anonymous users2024-02-03

    isalpha determines the ASCII value of 1 char, which is equivalent to:

    if ( c >= 'a') &c <= 'z')) c >= 'a') &c <= 'z')) else ;

    Chinese characters have various encodings, GB, BIG5, GBK, GB18030, corresponding to Unicode Big Endian, Unicode Little Endian, UTF-8, UTF-16, etc. UTF-8 may be 1 byte, 2bytes, 3bytes, .,

    So there's no way to simply solve the problem for you.

    Find out the code you typed and think about what to do.

    - Pure GB2312 original code, with double bytes, each byte encoding is greater than 0xa0 judgment.

  10. Anonymous users2024-02-02

    Because after coming to the kanji.

    Half of the source may not be less than bai0, and it may also satisfy duif(isalpha( p[i])) and it will be confused.

    Change the loop zhi to this, and daonumcha doesn't need to float while(p[i]!).='\0')

    if(isalpha( p[i]))

    numlet+=1;

    i++;

  11. Anonymous users2024-02-01

    Changed: Come.

    #include

    using namespace std;

    int main()

    else if(isalpha( p[i])) should be else if because if the first condition is true, the latter one does not need to be judged.

    i++;cout<<"The number of kanji is:"The number is:"Hope it helps!

  12. Anonymous users2024-01-31

    When you are judging, you should pay attention to the fact that the Chinese inner code occupies 2 bytes, and the highest bit of the high-level byte is 1, and our word back-to the mother and number only occupy an answer byte and the high-level cannot be 1, you have to judge whether it is a Chinese character, if it is a Chinese character, then the latter byte does not matter, because 1 Chinese character 2 bytes, if the high position is not 1, it means that this is not a Chinese character but a letter.

  13. Anonymous users2024-01-30

    *The arguments of the functions isalpha() and toupper() both need to be of the int type, and you pass the string type, so it cannot be compiled, you can convert the string type to the int type and use it.

    atoi (this method, you can see the following changes, the compilation has passed.) /#include

    #include

    #include

    using namespace std;

    int main()

    Changes here. else ;

    return 0;}

  14. Anonymous users2024-01-29

    Because the second half of the Chinese character may not be less than 0, and it may also satisfy if(isalpha( p[i])), it will be confused.

    Change the loop to this, and numcha doesn't have to float while(p[i]!).='\0')

    if(isalpha( p[i]))

    numlet+=1;

    i++;

  15. Anonymous users2024-01-28

    *iter is a string type, not an integer type.

    The parameters required by isalpha() and toupper() are both int.

Related questions
10 answers2024-05-21

1. First write the content of the note, as shown in the figure below. >>>More

3 answers2024-05-21

Summary. Here's a simple clock written in C** that prints out the current time (in hours, minutes, and seconds): include include int main() return 0; This ** uses the time function and the localtime function in the header file, as well as the printf function and the fflush function in the header file. >>>More

8 answers2024-05-21

Life numbers 1-9 human life analysis is:

No. 1 personality is independent, assertive, autonomous, vigorous, aggressive, and has leadership potential. If you can use your leadership skills correctly. >>>More

6 answers2024-05-21

Yi hexagram to explain the people to food as the meaning of the sky, two chopsticks, two innate hexagrams for the exchange. With, for the mouth, for eating. The chopsticks are straight and long, and they are Xun hexagrams. >>>More

13 answers2024-05-21

This number is 7, because the Lantern Festival is a lantern, which means that everyone in the Lantern Festival is a lantern together, the focus is to make trouble together, and the homonym is 7 Wanghua and adopted!