1,
//.格式转换,从一个文件中读取日期07/21/2016,转换为以下格式July 21,2016并输出到屏幕上
#include<iostream>
#include<fstream>
#include<cstring>
#include<string>
using namespace std;
void convert(char * s){
string month[]={"","January","February","March","April","May","June","July","August","Sep","October","November","December"};
string m;
int d;
int y;
char * token;
token = strtok(s,"/");
while (token!=NULL)
{
m = month[stoi(token)];
token = strtok(NULL,"/");
d = stoi(token);
token = strtok(NULL,"/");
y = stoi(token);
cout<<m<<" "<<d<<","<<y<<endl;
}
}
int main(){
string s;
ifstream infile("11.txt");
if(!infile.is_open()){
cout<<"error"<<endl;
}else{
getline(infile,s);
}
char c[20];
for(int i=0;i<s.length();i++){
c[i]=s[i];
}
convert(c);
return 0;
}