array of strings - need help

hi I am new here
I can't input array of strings (line 13). any ideas ??
it gives me runtime error on codeforces
please help !!



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
using namespace std;


int main()
{
	string str;
	char* arr[10];
	scanf("%s",&str);
	scanf("%c\n%c\n%c\n%c\n%c\n%c\n%c\n%c\n%c\n%c",&arr[0],&arr[1],&arr[2],&arr[3],&arr[4],&arr[5],&arr[6],&arr[7],&arr[8],&arr[9]);
	for(int i=0 ; i<8 ; i++)
	{
		string temp;
		temp=str.substr(i*10 , 10 );
		for (int v=0 ; v<10 ; v++)
		{
			if ( temp.compare(arr[v]) == 0)
				printf("%d",v);
		}
	}
}
Last edited on
Read in a loop, one at a time.

Why do you read "%c"? Isn't that a char?
You should read the description of scanf. You specified invalid argument in the function call.
Topic archived. No new replies allowed.