#include <iostream>
using namespace std;
#define OK 1
#define ERROR 0
#define OVERFLOW -2
#define MAXSIZE 100
typedef int Status;
typedef char ElemType;
typedef struct
{
ElemType *elem;
int length;
}SqList;
Status InitList(SqList &L)
{
L.elem = new ElemType[MAXSIZE];
if(!L.elem)
exit(OVERFLOW);
L.length = 0;
return OK;
}
Status CreatList(SqList &L, int n)
{
int i;
for(i = 0; i < n; i++)
cin >> L.elem[i];
L.length = n;
return OK;
}
Status DispList(SqList L)
{
int i;
for(i = 0; i < L.length; i++)
cout << L.elem[i];
return OK;
}
//小写转大写
int LowerList(SqList &La)
{
for (int i = 0; i < La.length; i++)
{
if (La.elem[i] <= 129 && La.elem[i] >= 97)
{
La.elem[i] -= 32;
}
}
return 0;
}
int main()
{
SqList La;
int n;
InitList(La);
cin >> n;
CreatList(La, n);
LowerList(La);
DispList(La);
return 0;
}
顺序表小写转大写
最新推荐文章于 2024-07-16 22:26:22 发布