#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
void swap(char* a,char* b)
{
int t=*a;
*a=*b;
*b=t;
}
void pai(char* buf,int k)
int n=strlen(buf);
char ch[27];
for(char i='A';i<='Z';i++)
ch[i]++;
if(k==n) cout << buf <<endl;
for(int i=k;i<=n;i++)
ch[*(buf+k)]++;
if(ch[*(buf+k)]>2)
continue;
swap(buf+k,buf+i);
pai(buf,k+1);
int main()
char p[4];
cin >> p;
pai(p,0);
return 0;
想要拓展问题的代码
不知道哪里出的问题
#include<iostream> using namespace std; int main() { int arr[10] = { 1,2,3,4,5,6,7,8,9,10}; cout << "整个数组占用内存空间为:" << sizeof(arr) << endl; cout << "每个元素占用内存为:" << sizeof(arr[0]) << endl; cout << "数组中元素个数为:" << sizeof(arr) / sizeof(arr[0]) << endl; cout << "数组首地址为:" << (int)arr << endl; }
为什么我这里的查看数组首地址使用int进行强转要报错
int a=7, b=3; { int g=a; a=b;b=g;} cout << a <<","<< b <<endl;
在这段代码最后的输出cout<< a << "," << b <<中中间为什么要用","作用又是什么?
char a = 'A'; char b = 9; char c = 66; char d = '\n'; int x = d; cout << a << b << x << c << endl;
在这段代码中66与X 分别代表着什么,int的含义是整数啊为什么后面会跟一个X?
int n = 90;
for(int i=2; i<=n-1; i++){
if(n & i == 0){
cout << i << endl;
n = n / i;
if(n > 1){
cout << n << endl;
如何阻止i的自增行为
enum week{Mon, Tue, Wed, Thu, Fri, Sat, Sun}
这里的变量默认是int类型吗?
int a = 10, b = 5; int c = 0; {c = a + b; } cout <<"a+b="<< c << endl; {c = a - b; } cout << "a-b=" << c << endl; {c = a * b; } cout << "a*b=" << c << endl; {c = a / b; } cout << "a/b=" << c << endl;
在多次运算中,加括号和不加括号有什么区别吗?
1.为什么这个N=x*20,怎么算出来的;
2.为什么a[i]中每个i都加2,是因为素数从2开始吗
&a什么意思,怎么用的?
不会装啊,下载下来都是文档 没有安装包
镜像网址我点进去显示404怎么回事,官网下载预计好几个小时好慢
为什么照着讲义的代码写了一遍会出现图中显示错误?
yu = a % b;9;中的9 是什么意思
void put_tag(int* p,int*end)
for(int*q=p+*p;q<end;q+=*p) *q=-1; //这行
int* next_pos(int* p,int* end)
while(++p<end && *p<0);
return (p<end)?p:NULL;
int get_nth(int x)
const int N=x*20;
int* a=new int [N];
for(int i=0;i<N;i++) a[i]=i+2;
int* p=a;
while(p!=NULL)
put_tag(p,a+N);
p=next_pos(p,a+N);
int t=-1;
for(int i=0;i<N;i++)
if(a[i]>0) x--;
if(x==0)
t=a[i];
break;
delete [] a;
return t;
cout << get_nth(5)<<endl;
这里边第六行开始的循环为什么让*q=p+*p,
比如带入此时p=3,那这个*q=(3的地址)+3,
而直接让*q=*p,也就是*q=3 不知道为什么输出不了
#include <iostream> using namespace std; int main() { cout<<"Hello world"<<endl; renturn 0; }
哪里不对啊
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637