VSC++赋值数组15个偶数并5个输出,判断回文字符

	//缘由https://bbs.csdn.net/topics/396522629?page=1#post-411413927
	int a[15]{}, j = 0;
    while (j < 15)a[j] = j * 2, ++j; j = 0;
	while (j<15)cout << (a[j]<10?" ":"") << a[j],
     (++j % 5 ? cout << ends : cout << endl);

	char aa[47]{}; cin >> aa; j = 0; while (aa[j++] != '\0'); --j;
	int jj = 0;
    while (jj < --j)
        if (aa[jj++] != aa[j])cout << "No", j = jj;
    else if(j<=jj)cout << "Yes";
int 判断回文(char* str)
{//缘由https://ask.csdn.net/questions/7592140?spm=1005.2025.3001.5141
	char *p = str, *q = p + strlen(str) - 1;
	while (*p == *q && p < q)p++, q--;
	return p >= q;
}
void 字符串左移一个字符(char* str)
{
	int al = 0;
	while (str[++al] != '\0')str[al - 1] = str[al];
	str[al - 1] = '\0';
}




	char a[] = "babad";
	int al = strlen(a);
	while (al > 1)
		a[al] = '\0',
		cout << (判断回文(a) ? a : "") << "\t",
		--al;
void 输出最长回文字符串()
{//缘由https://ask.csdn.net/questions/7591738?spm=1005.2025.3001.5141
	string s = "babad147741";
	int x = 0, y = 0, c = 0, b = 0, l = 0, al = s.length();
	char a[74]{};
	while (al - y>1)
	{
		while (s[x + y] != '\0')a[x] = s[x + y], ++x;
		while (x > 1)
			a[x] = '\0',
			(判断回文(a) ? cout << a << "\t",/**/
			(c < (l = strlen(a)) ? c = l, b = y : 0), 0 : 0),
			--x;
		++y; x = 0;
	}
	x = 0;
	while (s[x + b] != '\0')cout << s[x + b], ++x;
	cout << endl;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值