15 条题解

  • 6
    @ 2023-5-19 10:51:34

    解析:

    输入一个数n,输出 I'm n years old。

    参考答案:

    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        cout << "I'm " << n << " years old.";
        return 0;
    }
    

    易错点:

    1. n的左右两边都有空格,体现在代码中,就是输出的两句话中,第一句末尾和第二句开头,都有一个空格。
    2. 输出的语句要注意开头字母i要大写,末尾有个英文的标点符号。
  • 2
    @ 2023-5-20 17:36:57

    几岁啦

    思路:

    初始化设置→定义主函数→输入→拼接并输出

    代码:

    #include <iostream>
    using namespace std;//初始设置
    int main()//定义主函数
    {
        int a;
        cin >> a;//输入
        cout << "I'm " << a << " years old.";//拼接并输出
        return 0;
    }
    
    • 1
      @ 2024-5-26 19:49:15

      这是一个题解

      #include <bits/stdc++.h> //hetao4040809
      using namespace std;
      int main()
      {
          int n;
          cin>>n;
          cout<<"I'm "<<n<<" years old.";
          return 0;
      }
      
      • 1
        @ 2024-4-12 20:24:10
        #include<bits/stdc++.h>
        using namespace std;
        int main(){
            int a;
            cin>>a;
            cout<<"I'm "<<a<<" years old.";
            return 0;
        }666
        
        • 1
          @ 2023-8-8 16:20:41

          《阴郁砖加核墓》

          代码来辣

          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a;
              cin>>a;
              cout<<"I'm "<<a<<" years old.";
              //cout可以同时输出多个类型的数据(没想到吧
              return 0;
          }
          

          我是预言家,我知道你一定会给我点赞

          • 0
            @ 2024-6-8 19:09:28

            这什么恰到好处的空格啊

            • 0
              @ 2024-5-24 17:00:37
              #include <iostream>
              using namespace std;
              int main()
              {
                  int n;
                  cin >> n;
                  cout << "I'm " << n << " years old.";
                  return 0;
              }
              
              • 0
                @ 2024-1-13 18:18:03
                #输入禾木的年龄
                age=input()
                #输出禾木的年龄
                print ("I'm {} years old.".format(age))
                
                
                • 0
                  @ 2023-12-16 17:38:27

                  《下划线之歌》

                  #include<iostream>
                  using namespace std;
                  #define __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ int
                  #define _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ cin
                  #define ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ cout
                  __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ main()
                  {
                  __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________;
                  _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________>>___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________;
                  ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________<<"I'm "<<___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________<<" years old.";
                  }
                  
                  
                  • 0
                    @ 2023-8-6 17:23:44

                    P0003. 几岁啦

                    题目描述

                    过年了,禾木去亲戚家拜年,亲戚总是亲切的问他:“禾木,你几岁啦?”

                    禾木被问的有些烦了,想编写一个程序,自动回答。请你编程帮助禾木完成这个任务。

                    参考代码:

                    #include <bits/stdc++.h>
                    using namespace std;
                    long long n;
                    int main()
                    {
                        cin >> n;
                        cout << "I'm " << n << " years old.";
                        return 0;
                    }
                    
                    • 0
                      @ 2023-8-3 8:15:47

                      题解

                      懒得写注释了,自己看吧

                      #include <bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                          int n;
                          cin >> n;
                          cout << "I'm " << n << " years old.";
                          return 0;
                      }
                      

                      思路

                      输入n,输出 "I'm n years old"

                      转换为代码即以下

                      int n;
                      cin >> n;
                      cout << "I'm " << n << " years old."
                      
                      • 0
                        @ 2023-7-6 21:41:08
                        #include <iostream>
                        using namespace std;
                        
                        int main()
                        {   
                            int n;
                            cin >> n;
                            cout << "I'm "<< n <<" years old.";
                            return 0; 
                        }
                        
                        • 0
                          @ 2023-6-12 20:05:36

                          几岁啦


                          难度:

                          又是有手就行

                          思路:

                          定义整数变量→输入→输出


                          上代码:
                          #include <iostream> //必备工具
                          using namespace std;
                          int main() //程序的开始
                          {
                              int n; //定义一个整数变量n代表年龄
                              cin >> n; //输入年龄赋值给n
                              cout << "I'm " << n << " years old."; //输出 I'm 年龄 years old.
                              return 0; //程序结束
                          }
                          
                          • 0
                            @ 2023-6-3 16:36:43
                            #include<iostream>
                            using namespace std;
                            int main()
                            {
                                int n;
                                cin>>n;
                                cout<<"I'm "<<n<<" years old.";
                                return 0;
                            }
                            
                            • 0
                              @ 2023-5-20 23:11:54

                              几岁了

                              题意:

                              输出一个数n,输出“I'm” n(变量) “years old”

                              思路:

                              初始化 → 定义变量 → 外部输入赋值给变量 → 输出“文字” + 变量 + “文字” → 结束

                              题解:

                              #include <iostream>  //导入输入输出库
                              using namespace std;  //使用标准名称定义
                              int main()  //主函数
                              {
                                  int a;  //定义变量
                                  cin >> a;  //外部输入赋值给变量
                                  cout << "I'm" << a <<  " years old.";  //输出
                                  return 0;  //程序结束
                              }
                              

                              强调:注意空格!注意空格!!注意空格!!!

                              • 1

                              信息

                              ID
                              74
                              时间
                              1000ms
                              内存
                              256MiB
                              难度
                              6
                              标签
                              递交数
                              6997
                              已通过
                              2275
                              上传者