zoukankan      html  css  js  c++  java
  • 11.13的C++##不想写结构,更不爱指针

    //2019.11.13 卑微的Loving-Q瞎写的程序 报错请更改VS中的SDL检查
    // 我要去嗨了,在线卑微

    1
    #include<iostream> 2 #include<stdlib.h> 3 #include<math.h> 4 #include<cmath> 5 #include<cstdlib> 6 #include<stdio.h> 7 #include<string.h> 8 using namespace std; 9 //不想写结构,更不爱指针 10 11 //struct book { 12 // char name[40]; 13 // char place[35]; 14 // float price; 15 //}; 16 // 17 // 18 // 19 //int main() 20 //{ 21 // struct book library= 22 // { 23 // 24 // "fsdfsdgdfg", 25 // "gdadagfkj", 26 // 999.99 27 // }; 28 // 29 // 30 // cout << library.price; 31 // return 0; 32 // 33 //} 34 // 35 //struct book //结构数组 36 //{ 37 // char name[40]; 38 // float price; 39 //}; 40 // 41 //int main() 42 //{ 43 // int i; 44 // int u; 45 // struct book wunyanan[3]; 46 // printf("先输入字符串,在输入浮点型的数据,用Enter隔开 "); 47 // for (i = 0; i < 3; i++) 48 // { 49 // scanf("%s", &wunyanan[i].name); 50 // scanf("%f", &wunyanan[i].price); 51 // } 52 // for (u = 0; u < 3; u++) 53 // { 54 // cout << wunyanan[u].name << endl << wunyanan[u].price; 55 // } 56 // system("pause"); 57 // return 1; 58 //} 59 // ***********************************上面是结构体,下面是结构体的嵌套 60 struct a 61 { 62 int b; 63 float c; 64 }; 65 struct d 66 { 67 struct a first; 68 int e; 69 int f; 70 }; 71 72 int main() 73 { 74 int x; 75 struct d second = 76 { 77 { 234,44.23},55,6666 78 79 }; 80 81 for (x = 0; x < 5; x++) 82 { 83 cout << second.first.b<<endl; 84 } 85 return 0; 86 87 }
  • 相关阅读:
    第六天
    《分布式架构中数据一致性常见的几个问题》阅读心得
    第五天
    软件开发记录第四天
    资料整理
    Mongodb_分片集群模式
    MongoDB_spring整合mongodb
    安装环境
    MongoDB_副本集集群模式
    MongoDB_java连接MongoDB
  • 原文地址:https://www.cnblogs.com/Loving-Q/p/11869581.html
Copyright © 2011-2022 走看看