[問題] string的用法
%d=int
%f=float
%c=char
===>类推:%s =string
於是我寫了:
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int main ()
{
string a;
scanf("%s",&a);
printf("%s",a);
system("pause");
}
10 D:\Program Files\Dev-Cpp\my work\ppppppppp.cpp [Warning] cannot pass
objects of non-POD type `struct std::string' through `...'; call will abort
at runtime
输入后直接跳出没有映出
我該如何修改,或者說沒有這種用法?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.240.55
→
04/12 00:15, , 1F
04/12 00:15, 1F
推
04/12 00:16, , 2F
04/12 00:16, 2F
→
04/12 01:32, , 3F
04/12 01:32, 3F
→
04/12 07:27, , 4F
04/12 07:27, 4F
推
04/12 10:42, , 5F
04/12 10:42, 5F
→
04/12 14:31, , 6F
04/12 14:31, 6F
→
04/13 01:25, , 7F
04/13 01:25, 7F
→
04/13 01:26, , 8F
04/13 01:26, 8F
→
04/13 01:27, , 9F
04/13 01:27, 9F
→
04/13 01:29, , 10F
04/13 01:29, 10F
→
04/13 01:29, , 11F
04/13 01:29, 11F
→
04/13 01:32, , 12F
04/13 01:32, 12F
→
04/13 01:32, , 13F
04/13 01:32, 13F
討論串 (同標題文章)