第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

您好,請(qǐng)問(wèn)一下這個(gè)函數(shù)說(shuō)是定義不合法?該怎么理解呢?

您好,請(qǐng)問(wèn)一下這個(gè)函數(shù)說(shuō)是定義不合法?該怎么理解呢?

慕桂英3389331 2021-07-08 11:07:19
#include <stdio.h>#include <stdlib.h>#include <iostream>#define VOIDPARAMETER 0using namespace std;//交集bool Intersection(int a[], int b[], int m, int n){ cout<<"兩集合交集:"<<"{"; for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { if(a[i] == b[j])  { return true;}}cout<<endl;}//并集void AddSets(int a[], int b[], int m, int n){ bool flat;cout<<"兩集合并集:"<<"{";for(int i = 0; i < m; i++) { flat = true; for(int j = 0; j < n; j++) { if(a[i] == b[j]) { flat = false; break; } }  if(flat) cout<<a[i]<<' ';} for(int j = 0; j < n; j++) { cout<<b[j]<<' '; }if(i>=m){cout<<"}";}cout<<endl;} int main( ){ int n,m=1;cin>>n;for(m=1;m<=n;){ int N,M,i,j,k,flag,m1=2,n1=2;int c[100][100]={0};cin>>N>>" ">>M;for(k=1;k<=M;k++){cin>>c[k];}flag=1;while(flag){ flag=0;for(i=1;i<=M;i++)if c[i]!={0}{ for(j=i+1;j<=M;j++)if c[j]!={0}{ if(Intersection(c[i],c[j],m1,n1)==true){flag=1;c[i]=AddSets(c[i],c[j],m1,n1);c[j]={0};m1=m1+1;}elsec[i]=c[i];c[j]=c[j];}}}count=0;for(i=1;i<=M;i++)if c[i]!={0}count++;cout<<" 輸出非空數(shù)組的個(gè)數(shù):"<<count;}if(i>M)m++;break;}return 0;}
查看完整描述

2 回答

?
holdtom

TA貢獻(xiàn)1805條經(jīng)驗(yàn) 獲得超10個(gè)贊

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define VOIDPARAMETER 0
using namespace std;
//交集
bool Intersection(int a[], int b[], int m, int n)
{
cout<<"兩集合交集:"<<"{";
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
if(a[i] == b[j])
{
return true;
}
}
cout<<endl;
}// 缺少}
return false;
}
//并集
void AddSets(int a[], int b[], int m, int n)
{ bool flat;
cout<<"兩集合并集:"<<"{";
for(int i = 0; i < m; i++)
{
flat = true;
for(int j = 0; j < n; j++)
{
if(a[i] == b[j])
{
flat = false;

break;
}
}
if(flat) cout<<a[i]<<' ';
}
for(int j = 0; j < n; j++)
{
cout<<b[j]<<' ';
}
if(i>=m)
{
cout<<"}";
}
cout<<endl;
}

int main( )
{
int n,m=1,count;
int N,M,i,j,k,flag,m1=2,n1=2;
int c[100][100]={0};
cin>>n;
for(m=0;m<=n;)
{

cin>>N>>M;
for(i=0;i<N;i++)// 修改
{
for(k=0;k<M;k++)
{
cin>>c[i][k];
}
}
flag=1;
while(flag)
{
flag=0;
for(i=0;i<N;i++)
{
for(j=i+1;j<M;j++)
{
if (c[i][j]!=0) // 修改
{
if(Intersection(c[i],c[j],m1,n1)==true)
{
flag=1;
AddSets(c[i],c[j],m1,n1);
c[i][j]=0;
m1=m1+1;
}
//else
// c[i]=c[i];
// c[j]=c[j];
}
}
}
}
count=0;
for(i=0;i<N;i++)
{
for(j=i+1;j<M;j++)
{
if (c[i][j]!=0)
count++;
}
}
cout<<" 輸出非空數(shù)組的個(gè)數(shù):"<<count;
// if(i>M)
// m++;
// break;
// }
}

return 0;
}



查看完整回答
反對(duì) 回復(fù) 2021-07-11
?
慕的地6264312

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊

int a[]不合法

查看完整回答
反對(duì) 回復(fù) 2021-07-11
  • 2 回答
  • 0 關(guān)注
  • 301 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)