bycj.net
当前位置:首页 >> C语言多项式求和题 >>

C语言多项式求和题

main(){int i,j,n,m;float s=0.0;printf("input ceshishiligeshu(1<=m<100):");scanf("%d",&m);printf("input a int num(1<=n<1000):");scanf("%d",&n);for(j=1;j<m;j++){for(i=1;i<=n;i++) {if(i%2!=0) s+=s1/n; else s-=1/n; }printf("this is %d xiang shili:",j);printf(the sum is%f\n",s);}

void sum(vector<pair<int,int>> p, vector<pair<int,int>> q,vector<pair<int,int>> &r) { term a, b; int i,j; i=j=0; while (i<p.size() && j<q.size()) { a = p[i]; b = q[j]; if (a.second > b.second) { r.push_back(a); i++; } else if (a.second < b.second) { r.

void sum(vector> p, vector>q,vector> &r) { term a, b; int i,j; i=j=0; while(i b.second) { r.push_back(a); i++; } else if (a.second 评论0 0 0

#includemain(){int i,j,t=1;double sum=0.0,s=-1.0,k;for(j=1;j

# include <stdio.h># define P printf("\n*******************\n") void createA(int k,int a[]) { int i; printf("A="); for(i=0;i<=k;i++) if(i<=k-1) printf("%dx^%d+",a[i],i); else printf("%dx^%d",a[i],i); } void createB(int k,int a[]) { int i; for(i=0;i<=k;i++) if(i<=k

这个其实很简单,需要3个数组(暂时考虑int数组),长度都是10,分别保存多项式1、2和计算结果.初始化为全0.输入就按照你的假设吧.输入后三个数组分别为:多项式1:[7, 0, -5, 2, 0, 0, 0, 0, 0, 0](x的0次幂系数是7,x的1次幂系数是2,以此

#includevoid main(){int x,y;char op;int d;printf("第一个整数:");scanf("%d",&x);printf("第二个整数:");scanf("%d",&y);printf("运算符 (+,,*,/,%

我又个c++的,用到了数据结构中的链表,你参考一下 #include<iostream> #include<stdio.h> #include<malloc.h> using namespace std; typedef struct node {int coef,exp; struct node *next; }node,*linklist; void initlinklist(linklist L) { L=(linklist)malloc(

for (j=1;j { if (j%2==0) { j=j*(-1); } 这段死循环了 0 -> 2 -> -2 -> 2 -> -2

#include<iostream> #include<stdio.h> #include<malloc.h> using namespace std; typedef struct node {int coef,exp; struct node *next; }node,*linklist; void initlinklist(linklist L) { L=(linklist)malloc(sizeof(node)); L->next=NULL; } void creatlinklist(linklist

网站首页 | 网站地图
All rights reserved Powered by www.bycj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com