C++ 我如何旋转我的绳子90度(顺时针),90度(逆时针)和反射镜?
我在将字符串旋转到90度、-90度以及反射时遇到问题。我曾尝试使用朋友提供的旋转字符示例,但我不确定如何将其放入我的程序中。因此,我计划查看其他方法以使字符串旋转。下面是我的程序:C++ 我如何旋转我的绳子90度(顺时针),90度(逆时针)和反射镜?,c++,arrays,C++,Arrays,我在将字符串旋转到90度、-90度以及反射时遇到问题。我曾尝试使用朋友提供的旋转字符示例,但我不确定如何将其放入我的程序中。因此,我计划查看其他方法以使字符串旋转。下面是我的程序: #include <iostream> #include <cstdlib> #include <string> #include <cstring> #include <stdlib.h> using namespace std ; void di
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <stdlib.h>
using namespace std ;
void display(string letter, char DataType ) // To display string letter as well as changing the character in my array to other symbols.
{
char displayboard[20][40]; // The size of my displayboard.
const int RowI = 20 , ColumnJ = 40 ;
char board_A[RowI][ColumnJ] =
{
{' ' , ' ' , DataType , ' ' , ' ' },
{' ' , DataType , ' ' , DataType , ' ' },
{ DataType , ' ' , ' ' , ' ' , DataType },
{ DataType , ' ' , ' ' , ' ' , DataType },
{ DataType , DataType , DataType , DataType , DataType },
{ DataType , ' ' , ' ' , ' ' , DataType },
{ DataType , ' ' , ' ' ,' ' , DataType }
};
char board_B[RowI][ColumnJ] =
{
{DataType , DataType , DataType , DataType , ' ' },
{DataType , ' ' , ' ' , ' ' , DataType },
{DataType , ' ' , ' ' , ' ' , DataType },
{DataType , DataType , DataType , DataType , ' ' },
{DataType , ' ' , ' ' , ' ' , DataType },
{DataType , ' ' , ' ' , ' ' , DataType },
{DataType , DataType , DataType ,DataType , ' ' }
};
int main()
{
string letter ;
char DataType ;
string displayboard(int RowI , int ColumnJ , const char A[20][40]) ;
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl ;
cout << "| Please enter words or numbers: |" << endl ;
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl ;
cout << "Insert here =>" ;
getline(cin , letter); // To output my string letter from the board.
cout << endl << endl << endl ;
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl ;
cout << "| Please enter your symbol: |" << endl ;
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl ;
cout << "Insert here =>";
cin >> DataType;
display( letter, DataType); // To display my character of my string letter.
}
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
void display(string letter,char DataType)//显示字符串letter,并将数组中的字符更改为其他符号。
{
char displayboard[20][40];//我的显示板的大小。
const int RowI=20,ColumnJ=40;
char board_A[RowI][ColumnJ]=
{
{“”,'',数据类型,'',''},
{“”,数据类型“”,数据类型“”},
{DataType','','',DataType},
{DataType','','',DataType},
{DataType,DataType,DataType,DataType,DataType},
{DataType','','',DataType},
{DataType','','',DataType}
};
char board_B[RowI][ColumnJ]=
{
{DataType,DataType,DataType,DataType,'},
{DataType','','',DataType},
{DataType','','',DataType},
{DataType,DataType,DataType,DataType,'},
{DataType','','',DataType},
{DataType','','',DataType},
{DataType,DataType,DataType,DataType,'}
};
int main()
{
字符串字母;
字符数据类型;
字符串显示板(int RowI,int ColumnJ,const char A[20][40]);
这只是我代码的一部分,对于我的完整代码,我使用switch case来打断字符。我在代码中看到的只是输出到控制台。控制台(终端)的图形功能可能有限。但是,我开始好奇Unicode提供了什么,并在谷歌上搜索了“Unicode旋转字符”:。当然,只有当1.您的控制台支持Unicode和2.使用的字体具有必要的标志符号时,才会出现这种情况。我曾经尝试将Windows控制台切换到UTF-8,但输出非常令人沮丧。正如我提到的和(这是一种Unicode码点的字节编码,即typechar
可用于存储字符串),这可能也会有帮助:。(标题可能听起来很吓人,但文章很好。)