【发布时间】:2023-02-09 00:12:25
【问题描述】:
我正在编写一个程序,将大写数组转换为小写,然后反转 降低阵列。
#include <iostream>
using namespace std;
int main()
{
char upper[10];
cout << "Please enter a string" << endl;
cin >> upper;
int ascii;
ascii = upper; #error is here it says a value of type char cannot be assigned to int
ascii = ascii + 32;
}
【问题讨论】:
-
我确定错误实际上是说它无法将数组转换为
int- 因为您将如何定义这样的转换? -
您需要一个循环或一个循环函数,对
upper中的每个字符执行转换。你目前两者都没有。循环将在您的语言参考中广泛涵盖。
标签: c++