定义一个字符数组并初始化,然后输出其中字符串
#include<iostream> using namespace std; int main(){ char str[]="Winer Winer Chicken Dinner"; cout<<str<<endl; int a[8]={1,864,89,46,48,35,24}; for(int i=0;i<8;i++){ cout<<a[i]<<endl; } }
#include<iostream> #include <string.h> using namespace std; int main(){ char str[]="rua rua rua"; char str2[]={9,8,24}; strcpy(str2,str); cout<<str2<<endl; }