8 条题解

  • 3
    @ 2022-3-28 11:40:26

    强制类型转换即可:

    #include <bits/stdc++.h>
    
    using namespace std;
    
    int main() {
        int x;
        cin >> x;
        cout << char(x) << endl;
        return 0;
    }
    
    • 2
      @ 2022-6-5 17:35:14

      直接数据类型转换即可

      #include<iostream>
      using namespace std;
      int c;
      int main(){
          cin>>c;
          cout<<(char)c<<endl;
      

      AC记录:

      https://www.luogu.com.cn/record/65325212

      • @ 2024-5-8 21:53:20

        标准CE代码

        /tmp/compiler_18zuj9ah/src: 在函数‘int main()’中:
        /tmp/compiler_18zuj9ah/src:7:25: 错误:expected ‘}’ at end of input
            7 |     cout<<(char)c<<endl;
              |                         
                ^/tmp/compiler_18zuj9ah/src:5:11: 
        附注:to match this ‘{’
            5 | int main(){
              |           ^
        
    • 1
      @ 2024-5-8 21:50:33

      强制转换即可

      #include <cstdio>
      using namespace std;
      int main(){
          int n;
          scanf("%d", &n);
          printf("%c", n);
          return 0;
      }
      
      • 1
        @ 2023-10-1 11:20:53
        #include<iostream>
        using namespace std;
        int main(){
        	int a;
        	cin >> a;
        	cout << char(a);
        	return 0;
        }
        
        • 0
          @ 2023-10-22 10:54:41
          #include <iostream>
          using namespace std;
          int main()
          {
              int a;
              cin>>a;
              cout<<(char)a<<endl;
              return 0;
          }
          
          • 0
            @ 2023-8-20 15:43:20

            `` #include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; cout<<char(a); return 0; }

            ``

            • -1
              @ 2022-12-27 9:59:23
              #include<bits/stdc++.h>
              using namespace std;
              long long q,w,e,r,t,y,u,i,o,p,d,f,g,h,j,k,l,z,x,c,v,b,n,m;
              string s;double dd,ee,ff=3.14159;char cc;
              long long a[100000],as[100000],asd[100000];
              int main()
              {
              	cin>>n;
              	cc=n;
              	cout<<cc;
                  return 0;
              }
              
              • -3
                @ 2022-6-12 8:40:53
                #include<bits/stdc++.h>
                using namespace std;
                long long q,w,e,r,t,y,u,i,o,p,d,f,g,h,j,k,l,z,x,c,v,b,n,m;
                string s;double dd,ee,ff=3.14159;char cc;
                long long a[100000],as[100000],asd[100000];
                int main()
                {
                	cin>>n;
                	cc=n;
                	cout<<cc;
                    return 0;
                }
                
                
                • 1

                信息

                ID
                6830
                时间
                1000ms
                内存
                128MiB
                难度
                1
                标签
                (无)
                递交数
                92
                已通过
                71
                上传者