Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- using namespace std;
- bool znak(char* slowo){
- if((strlen(slowo) > 1 && (slowo[0] >= 'a' && slowo[0] <= 'z')) || (slowo[0] >= 'A' && slowo[0] <= 'Z') || (slowo >= 33 && slowo <= 47)) {
- return true;
- }
- return false;
- }
- int main(){
- int n;
- char slowo1[11],slowo2[11];
- scanf("%d",&n);
- for(int i=0;i<n;i++){
- scanf("%s",&slowo1);
- scanf("%s",&slowo2);
- int x=atoi(slowo1);
- int y=atoi(slowo2);
- if (!znak(slowo1) && !znak(slowo2)){
- int suma=0;
- suma=x+y;
- printf("%d ",suma);
- }
- else if (znak(slowo1) && znak(slowo2)){
- printf("%c ",strcat(slowo1,slowo2));
- }
- else if (znak(slowo1) && !znak(slowo2)){
- printf("%c ",slowo1[y-1]);
- }
- else
- printf("%c \n",slowo2[x-1]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement