C ++ [错误]无法通过'...'传递非平凡复制类型'std :: string {aka class std :: basic_string <char>}'的对象

时间:2020-08-08 01:53:08

标签: c++ string printf

这是我的代码,它得到一个我不知道的错误([错误]无法通过'...'传递非平凡复制类型'std :: string {aka class std :: basic_string}'的对象)不明白,有人可以帮忙吗

#include<cstdio>
//#include<string.h>
#include <string>
using namespace std;
int k,n,c=0,len,len2;
//char dis[10][100],w[100];
bool bb;
string a,b,temp;
string bad[999];
int main (){
    scanf("%d",&k);
    for (int i=0;i<k;i++){
        scanf("%s",&bad[i]);
    }
    scanf("%d",&n);
    for (int i=0;i<n;i++){
        scanf("%s",&a);
        b=true;
        for (int j=0;j<k;j++){
            len=a.length();
            len2=b.length();
//          for (int l=0;l<len;l++){
                if (len==len2){
                    if (a==bad[j]){
                        bb=false;
                        break;
                    }
                }
//          }
        }
        if (bb){
            if (i>0){
                printf(".");
            }
            temp=toupper(a[0]);
            printf("%s",temp);
        }
    }
    printf("\n");
return 0;}


line 36 col 20  [Error] cannot pass objects of non-trivially-copyable type 'std::string {aka class std::basic_string<char>}' through '...'

0 个答案:

没有答案
相关问题