猫史档案馆


来电cpp代码

用户:蒟蒻OIer1048576蒟蒻OIer1048576查看:6 回复:2 评论:6 创建时间:2020-07-13T19:19:46



#include <iostream>
//i = input,o = output
using namespace std;
void int_input(int* result,string msg)
{
    cout << msg;
    cin >> *result;
}
int main(int argc,char* argv)
{
    int a,b;
    input(&a,"第一个数?");
    input(&b,"第二个数?");
    cout << a+b << endl;
    ;;

    return 0;
}


回复

上一页1 页 / 共 1下一页
白篮白篮

这个studio.h也行额

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#include <iostream>
using namespace std;
void output_char_times(char charater,int times)
{
    for(int i = 0;i < times;i++)
    {
        cout << charater;
    }a
}
void newline(void)
{
    cout << endl;
}
void int_input(int* result,string msg)
{
    cout << msg;
    cin >> *result;
}
int main(int argc,char* argv)
{
    const tree_down_lines = 3
    int times,all_times;
    int a;
    input(&a,"几层树?");
    for(int i = 0; i < a;i++)
    {
        times = 2*i + 1;
        all_times = 2*a + 1;
        output_char_times(' ',(all_times-times)/2)
        output_charac_times('@',times)
        output_char_times(' ',(all_times-times)/2)
    }
    for(int i = 0,i < tree_down_lines)
    {
        output_char_times(' ',(all_times-1)/2)
    }

    return 0;
}

点赞0


评论