[ create a new paste ] login | about

Link: http://codepad.org/stxYOvnv    [ raw code | output | fork ]

C++, pasted on Dec 30:
#include <fstream>
#include <string>
using namespace std;
ifstream  cin("input.txt");
ofstream cout("output.txt");
string s, st[11];
int h, i, j, k, pos[11];
char c[11][11];
int main()
{
cin >>h;
for (i=1; i<=h; i++) cin >>pos[i];
getline(cin, s);getline(cin, s);
 
len = s.length();
k = len / h;
for (i=0; i<h; i++) 
    {
    for (j=0; j<k; j++)
        st[pos[i+1]] += s[i*k + j];
    t++;
    }
 
for (j=1; j<=k; j++)
    for (i=0; i<h; i++)
    cout <<st[i];
return 0;   
}
//-------------пробовал такой вариант, тоже не пошло(
s = "";
for (j=1; j<=k; j++)
    for (i=0; i<h; i++)
    s += c[i][j];
    cout <<s;
return 0;   
}


Output:
1
2
3
In function 'int main()':
Line 11: error: reference to 'cin' is ambiguous
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: