-
Notifications
You must be signed in to change notification settings - Fork 0
/
UVA 11483.cpp
51 lines (51 loc) · 1.14 KB
/
UVA 11483.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,k,j,l,cs=1;
string d="\\\\",e="\\\"",start="printf(\"",en="\\n\");";
string s1, s;
while(cin>>n)
{
string arr[150];
if(n==0)
{
break;
}
while(getchar()!='\n');
arr[0]="#include<string.h>";
arr[1]="#include<stdio.h>";
arr[2]="int main()";
arr[3]="{";
k=4;
for(i=0; i<n; i++)
{
s1.clear();
s.clear();
getline(cin,s);
l=s.size();
for(j=0; j<l; j++)
{
if(s[j]=='"')
s1+=e;
else if(s[j]=='\\')
s1+=d;
else
s1+=s[j];
}
s1=start+s1+en;
arr[k]=s1;
k++;
}
arr[k]="printf(\"\\n\");";
k++;
arr[k]="return 0;";
k++;
arr[k]="}";
printf("Case %d:\n",cs);
cs++;
for(i=0;i<=k;i++)
cout<<arr[i]<<endl;
}
return 0;
}