编程题:大小字母互换
编程题:大小字母互换
string str = Console ReadLine();
int cha = 32;
for(int i = 0;i <str.length;i++)
{
if (str[i]>= 'a' && str[i]<= 'z')
{
char c = (char)(str[i]-32);
Console.Write(c);
}
else if (str[i]>= 'A' && str[i]<= 'Z')
{
char c = (char)(str[i]+32);
Console.Write(c);
}
else{
Console.Write(str[i]);
}
}
string str = Console.ReadLine();
string[] strArray = str.Split("");
int[] intArray = new int[strArray.Length];
for (int i =0; i < strArray.Length; i++){
int number = Convert.ToInt32(strArray[i]);
intArray[i]= number;
}
int n = Convert.ToInt32(Console.ReadLine());
int location = -1;
for(int i =0;i<intarray.length;i++)
{
if(n == intarray[i])
{
location= i+1;//题目要求是以1为开始
break;
}
}
Console.WriteLine(location);