布尔函数求零代多项式的C语言程序

布尔函数求零代多项式的C语言程序,第1张

#include<stdio.h>void main(){int a,b,cscanf("%d%d%d",&a,&b,&c)printf("%d,%d,%d\n",a,b,c)}

#include <iostream>

using namespace std

bool fun(int *a,int n)

{

int i=0int coun=0

while(i!=n)

{

if(a[i]==1)

{

coun++

i++

}

else{

i++

if(coun%2!=0)

return false

coun=0

}

}

if(coun%2==0) /////////要想想为什么

return true

return false

}

int main()

{

  cout<<"input the size of the array: "<<endl

  int size

  cin>>size

  int a[100]

  cout<<"Input the value: "<<endl

  for(int i=0i<sizei++)

  {

  cout<<"a["<<i<<"]"<<":"

  cin>>a[i]

  }

  if(fun(a,size))

  cout<<"there are all double"<<endl

  else

  cout<<"there are not all double"<<endl

  cout <<"Hello world!" <<endl

  return 0

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11283456.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存