cpp--data type

cpp允许用户根据自己声明一些类型【数组,结构体类型,共用体类型,枚举类型,类类型】user-defined type

 1 #include <iostream>
 2 using namespace std;
 3 
 4 struct Data
 5 {
 6     int month;
 7     int day;
 8     int year;
 9 };
10 struct Student
11 {
12     int num;
13     char name[20];
14     char sex;
15     Data birthday;
16     float score;
17 }student1,student2={10002,"hello",'b',5,23,9000,90};
18 int main()
19 {
20     student1=student2;
21     cout<<"student1 info about:"<<endl;
22     cout<<"num:"<<student1.num<<endl;
23     cout<<"name:"<<student1.name<<endl;
24     cout<<"sex:"<<student1.sex<<endl;
25     cout<<"month:"<<student1.birthday.month<<endl;
26     cout<<"year:"<<student1.birthday.year<<endl;
27     cout<<"score:"<<student1.score<<endl;
28 }

结构体数组:每个数组元素都是一个结构体类型的数据,他们都分别包括各个成员项

 1 #if 0
 2 3个候选人,最终有一个人当选,10个人参与投票,键盘输入3个候选人名字(10次),输出每个候选人的得票结果
 3 #endif
 4 
 5 #include <iostream>
 6 using namespace std;
 7 
 8 struct Person//声明结构体类型Person
 9 {
10     char name[20];
11     int cout;
12 }leader[3]={"a",0,"b",0,"c",0};//定义Person类型的数组leader
13 int main()
14 { 
15     int i,j;
16     string leader_name;//字符变量
17     for(i=0;i<10;i++)
18     {
19         cin>>leader_name;
20         for(j=0;j<3;j++)
21             if(leader_name==leader[j].name)//将输入的名字与候选人名字作对比
22                 leader[j].cout++;//相同,计数+1
23     }
24     cout<<endl;
25     for(i=0;i<3;i++)
26         cout<<leader[i].name<<":"<<leader[i].cout<<endl;
27     return 0;
28 
29 }

 

转载于:https://www.cnblogs.com/Blue-Moniter4/p/9551366.html

FAILED: cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o D:\android\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --sysroot=D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DFEATURE_BLOCK_ENABLE_OPENCV -DINFERENCE_WRAPPER_ENABLE_MNN -DISF_BUILD_SHARED_LIBS -DInspireFace_EXPORTS -DSODIUM_STATIC -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/InspireCV/3rdparty/Eigen-3.4.0-Headers -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/. -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/MNN/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/libsodium-cmake-master/libsodium/src/libsodium/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/libcorrect/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/include/inspireface -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/yaml-cpp/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/inspireface-precompile-lite/sqlite -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/InspireCV/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -g0 -std=c++14 -O3 -O3 -mfpu=neon -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o -MF cpp\inspireface\CMakeFiles\InspireFace.dir\c_api\inspireface.cc.o.d -o cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o -c D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:8: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface_internal.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./engine/face_session.h:13: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_track_module.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_detect/face_detect_adapt.h:10: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/any_net_adapter.h:15: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/model_archive/inspire_archive.h:15: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:13:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage] typedef struct { ^ SemanticIndex D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:14:31: note: type is not C-compatible due to this default member initializer int32_t left_eye_center = 67; ^~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:23:3: note: type is given name 'SemanticIndex' for linkage purposes by this typedef declaration } SemanticIndex; ^ In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:8: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface_internal.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./engine/face_session.h:13: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_track_module.h:16: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/tracker_optional/bytetrack/BYTETracker.h:33:141: warning: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] double lapjv(const vector<vector<float> > &cost, vector<int> &rowsol, vector<int> &colsol, bool extend_cost = false, float cost_limit = LONG_MAX, ~ ^~~~~~~~ D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ <built-in>:84:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:117:20: error: use of undeclared identifier 'token' result->size = token.size(); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:118:37: error: use of undeclared identifier 'token' result->data = (uint8_t*)malloc(token.size()); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:119:26: error: use of undeclared identifier 'token' memcpy(result->data, token.data(), token.size()); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:119:40: error: use of undeclared identifier 'token' memcpy(result->data, token.data(), token.size()); ^ 2 warnings and 4 errors generated. [545/568] Building CXX object cpp/inspireface/CMakeFiles/InspireFace.dir/track_module/face_track_module.cpp.o clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.cpp:6: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_detect/face_detect_adapt.h:10: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/any_net_adapter.h:15: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/model_archive/inspire_archive.h:15: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:13:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage] typedef struct { ^ SemanticIndex D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:14:31: note: type is not C-compatible due to this default member initializer int32_t left_eye_center = 67; ^~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:23:3: note: type is given name 'SemanticIndex' for linkage purposes by this typedef declaration } SemanticIndex; ^ In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.cpp:6: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.h:16: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/tracker_optional/bytetrack/BYTETracker.h:33:141: warning: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] double lapjv(const vector<vector<float> > &cost, vector<int> &rowsol, vector<int> &colsol, bool extend_cost = false, float cost_limit = LONG_MAX, ~ ^~~~~~~~ D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ <built-in>:84:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. [546/568] Building CXX object cpp/inspireface/CMakeFiles/I...track_module/tracker_optional/bytetrack/kalmanFilter.cpp.o clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [547/568] Building C object cpp/inspireface/CMakeFiles/Ins...__/3rdparty/inspireface-precompile-lite/sqlite/sqlite3.c.o ninja: build stopped: subcommand failed. Build-AndroidArch : Ninja 编译失败! 所在位置 D:\insightface-master\insightface-master\cpp-package\inspireface\command\build_android.ps1:247 字符: 1 + Build-AndroidArch "arm64-v8a" 21 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Build-AndroidArch
08-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值