测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A62558. 阅读下面的C++程序,输入一个整数 40,则输出的结果为 ( )#include<bits/stdc++.h>

单选题

题目描述

阅读下面的C++程序,输入一个整数 40,则输出的结果为 (   )

#include<bits/stdc++.h>
using namespace std;
int n,cnt;
bool f(int x)
{
    int s=0,t=x;
    while(t!=0){s=s*10+(t%10);t/=10;}
    return(s==x);
}
int main()
{
    cin>>n;
    for(int i=l;i<=n;i++)
        if(f(i)) cnt++;
    cout<<cnt;
    return 0;
}

选项(单选)