| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么run time error 啊?求救!!大虾帮忙!!#include<iostream>
#include<string>
using namespace std;
void main()
{
int n,k1,k2,i,j;
int * ptr;
string s1,s2,s3,s4;
cin>>n;
while(n!=0){
ptr = new int [n];
for(i=0;i<n;i++)
cin>>ptr[i];
cin>>k1;
cin.get();
getline(cin,s1);
cin>>k2;
cin.get();
getline(cin,s2);
if(s1.length()<n)
s1.resize(n);
if(s2.length()<n)
s2.resize(n);
s3=s1;
for(j=0;j<k1;j++){
for(i=0;i<s1.length();i++){
s3[ptr[i]-1]=s1[i];
}
s1=s3;
}
s4=s2;
for(j=0;j<k2;j++){
for(i=0;i<s2.length();i++)
s4[ptr[i]-1]=s2[i];
s2=s4;
}
for(i=0;i<s3.length();i++)
cout<<s3[i];
cout<<endl;
for(i=0;i<s4.length();i++)
cout<<s4[i];
cout<<endl;
cout<<endl;
cin>>n;
cin>>n;
}
delete []ptr;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator