前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >关于上面c++运行结果

关于上面c++运行结果

作者头像
仇诺伊
发布2018-09-12 14:43:07
2.7K0
发布2018-09-12 14:43:07
举报
文章被收录于专栏:佳爷的后花媛佳爷的后花媛
代码语言:javascript
复制
Last login: Sat Oct 28 13:38:17 on ttys000
➜  ~ g++ useFunction.cpp
clang: error: no such file or directory: 'useFunction.cpp'
clang: error: no input files
➜  ~ cd Desktop/arithmetic
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
9
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
22
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
9
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
2
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
sum = 5050
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:193:30: error: member reference base type 'const char [12]' is not a
      structure or union
        printf("a[%d] = %d\n".i,a[1]);
               ~~~~~~~~~~~~~~^~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:193:30: error: member reference base type 'const char [12]' is not a
      structure or union
        printf("a[%d] = %d\n".i,a[1]);
               ~~~~~~~~~~~~~~^~
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
a[0] = 3
a[1] = 3
a[2] = 3
a[3] = 3
a[4] = 3
a[5] = 3
a[6] = 3
a[7] = 3
a[8] = 3
a[9] = 3
➜  arithmetic ./a.out
a[0] = 3
a[1] = 3
a[2] = 3
a[3] = 3
a[4] = 3
a[5] = 3
a[6] = 3
a[7] = 3
a[8] = 3
a[9] = 3
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
a[0] = 5
a[1] = 3
a[2] = 2
a[3] = 6
a[4] = 8
a[5] = 4
a[6] = 0
a[7] = 0
a[8] = 0
a[9] = 0
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:202:20: warning: relational comparison result unused
      [-Wunused-comparison]
    for(int i = 1;i<10,i++){
                  ~^~~
useFunction.cpp:202:27: error: expected ';' in 'for' statement specifier
    for(int i = 1;i<10,i++){
                          ^
useFunction.cpp:206:32: error: member reference base type 'int' is not a structure
      or union
        printf("a[%d] = %d\n",i.a[i]);
                              ~^~
1 warning and 2 errors generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1
a[0] = 1
a[1] = 2
a[2] = 4
a[3] = 8
a[4] = 16
a[5] = 32
a[6] = 64
a[7] = 128
a[8] = 256
a[9] = 512
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
a = 2,b = 1
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:223:5: error: unknown type name 'itn'
    itn a[10] = {3,4,2,5,6,7};
    ^
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
234567%                                                                             ➜  arithmetic g++ useFunction.cpp
useFunction.cpp:242:29: warning: implicit conversion from 'double' to 'int' changes
      value from 8.4 to 8 [-Wliteral-conversion]
    int a[5][6] = {{3,1,2},{8.4},{},{1,2,3,4,5}};
                           ~^~~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
312000
840000
000000
123450
000000
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:261:13: error: use of undeclared identifier 'j'
        for(j=0;j<3;j++){
            ^
useFunction.cpp:261:17: error: use of undeclared identifier 'j'
        for(j=0;j<3;j++){
                ^
useFunction.cpp:261:21: error: use of undeclared identifier 'j'
        for(j=0;j<3;j++){
                    ^
useFunction.cpp:262:30: error: use of undeclared identifier 'j'
            scanf("%d",&b[i][j]);
                             ^
4 errors generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
123
456
789
147
258
369

789
��������������������������������� Session Restarted ��������������������������������
Last login: Sat Oct 28 13:43:28 on ttys000
➜  ~ ./a.out
zsh: no such file or directory: ./a.out
➜  ~ cd Desktop/arithmetic
➜  arithmetic ./a.out
123
456
789
234
234
234
234
234
^C
➜  arithmetic cd Desktop/arithmetic
cd: no such file or directory: Desktop/arithmetic
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:275:20: error: unexpected ';' before ')'
        printf("\n";)
                   ^
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
123
123
123
123
123
123
^C
➜  arithmetic ./a.out
12345678909876543
^C
➜  arithmetic ./a.out
1 2 3
4 5 6
7 8 9
1 4 7
2 5 8
3 6 9
2610
61014
101418
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
00000
-1-1-1-1-1
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
^_^
^_^
_^_
^_^
^_^
_^_
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
warning: this program uses gets(), which is unsafe.
WpAiDeRenBuAiWo
QAQ
T_T
WoAiNi
WpAiDeRenBuAiWo
QAQ
T_T
WoAiNi
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
T^T
T^T
➜  arithmetic ./a.out
T_T
T_T
➜  arithmetic ./a.out
hd;akhjfksfhu
hd;
➜  arithmetic ./a.out
owhf a;ijfa
owh
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
warning: this program uses gets(), which is unsafe.
memda
5
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
warning: this program uses gets(), which is unsafe.
Dear Mozart
Canon
str1>str2
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:373:9: error: assigning to 'int' from incompatible type 'void'
    x = change(x);
        ^~~~~~~~~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:373:7: error: invalid operands to binary expression
      ('int' and 'void')
    x ==  change(x);
    ~ ^   ~~~~~~~~~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:373:19: error: cannot pass expression of type 'void' to variadic
      function; expected type from format string was 'int'
    printf("%d\n",change(x));
                  ^~~~~~~~~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:369:5: error: void function 'change' should not return a value
      [-Wreturn-type]
    return x;
    ^      ~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:369:5: error: void function 'change' should not return a value
      [-Wreturn-type]
    return 0;
    ^      ~
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:374:5: error: no matching function for call to 'change'
    change(x);
    ^~~~~~
useFunction.cpp:368:6: note: candidate function not viable: requires 0 arguments,
      but 1 was provided
void change(){
     ^
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
10
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
11
➜  arithmetic ./a.out
11
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1
3
5
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
4
24
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
233, 233
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
233
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:19: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d\n",p);
            ~~    ^
1 warning generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:421:9: error: cannot initialize a variable of type 'int' with an
      rvalue of type 'int *'
    int p = &a;
        ^   ~~
1 error generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:19: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d\n",&a);
            ~~    ^~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:17: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d",&a);
            ~~  ^~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:17: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d",&a);
            ~~  ^~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:22: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d,%d\n",&a ,a);
            ~~       ^~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:423:22: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("%d,%d\n",&a, a);
            ~~       ^~
1 warning generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1 2 3 4 5 6 7 8 9 10
12345678910%                                                                        ➜  arithmetic ./a.out
123456789
10
1 2 3 4 5 6 7 8 9 10
1234567891012345678%                                                                ➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
12345678910%                                                                        ➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
12345678910%                                                                        ➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:23: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n",q);
                ~~    ^
useFunction.cpp:458:23: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n",p);
                ~~    ^
useFunction.cpp:459:27: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n",q-p);
                    ~~    ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n", q);
                ~~     ^
useFunction.cpp:458:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n", p);
                ~~     ^
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n", q);
                ~~     ^
useFunction.cpp:458:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n", p);
                ~~     ^
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n", q);
                ~~     ^
useFunction.cpp:458:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n", p);
                ~~     ^
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
233
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n", q);
                ~~     ^
useFunction.cpp:458:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n", p);
                ~~     ^
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:457:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("q = %d\n", q);
                ~~     ^
useFunction.cpp:458:24: warning: format specifies type 'int' but the argument has
      type 'int *' [-Wformat]
    printf("p = %d\n", p);
                ~~     ^
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
3 warnings generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:459:28: warning: format specifies type 'int' but the argument has
      type 'long' [-Wformat]
    printf("q - p = %d\n", q-p);
                    ~~     ^~~
                    %ld
1 warning generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
q = 36
p = 1
q - p = 35
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:459:28: error: indirection requires pointer operand ('long' invalid)
    printf("q - p = %d\n", *(q-p);
                           ^~~~~~
useFunction.cpp:473:5: error: expected '}'
// }
    ^
useFunction.cpp:453:11: note: to match this '{'
int main(){
          ^
2 errors generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:459:28: error: indirection requires pointer operand ('long' invalid)
    printf("q - p = %d\n", *(q-p)};
                           ^~~~~~
useFunction.cpp:473:5: error: expected '}'
// }
    ^
useFunction.cpp:453:11: note: to match this '{'
int main(){
          ^
2 errors generated.
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:459:28: error: indirection requires pointer operand ('long' invalid)
    printf("q - p = %d\n", *(q-p));
                           ^~~~~~
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
*q = 36
*p = 1
*q - *p = 35
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
a = 2,b = 1
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
a = 2,b = 1
➜  arithmetic g++ useFunction.cpp
useFunction.cpp:532:1: error: extraneous closing brace ('}')
}
^
1 error generated.
➜  arithmetic g++ useFunction.cpp
➜  arithmetic ./a.out
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017.10.29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档