标签:output eal i++ 技术 void 排序 ati png fine
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
void solve(double a,double b,double c);
int main() {
double a,b,c;
printf("Enter a,b,c: ");
while(scanf("%lf%lf%lf",&a,&b,&c)) {
solve(a,b,c);
printf("Enter a,b,c:");
}
system("pause");
return 0;
}
void solve(double a,double b, double c) {
double x1,x2;
double delta,real,imag;
if(a==0)
printf("not quadratic equation.\n");
else {
delta = b*b-4*a*c;
if(delta >= 0) {
x1 = (-b + sqrt(delta))/(2*a);
x2 = (-b - sqrt(delta))/(2*a);
printf("x1 = %f,x2 = %f\n",x1,x2);
}
else {
real = -b/(2*a);
imag = sqrt(-delta)/(2*a);
printf("x1 = %f + %fi,x2 = %f-%fi\n",real,imag,real,imag);
}
}
}
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
void printcircle(int x,int y);
int main() {
system("color 02");
printcircle(5,10);
Sleep(5000);
system("cls");
printcircle(10,5);
system("pause");
return 0;
}
void printcircle(int x,int y) {
int line, col;
for(line = 1;line <= y-1; line++ )
printf("\n");
for(col = 1;col <= x-1;col++)
printf(" ");
printf("0");
printf("\n");
}
#include<stdio.h>
#include<stdlib.h>
#define N 1000
int fun(int n,int m,int bb[N]) {
int i,j,k=0,flag;
for(j=n;j<=m;j++) {
flag=1;
for(i=2;i<j;i++)
if(j%i==0) {
flag=0;
break;
}
if(flag==1)
bb[k++]=j;
}
return k;
}
int main() {
int n=0,m=0,i,k,bb[N];
scanf("%d",&n);
scanf("%d",&m);
for(i=0;i<m-n;i++)
bb[i]=0;
k=fun(n,m,bb);
for(i=0;i<k;i++)
printf("%4d",bb[i]);
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#define N 100
void fun(int x[N][N],int n) {
int i,j;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i>=j)
x[i][j]=i;
else
x[i][j]=j ;
}
int main() {
int n,i,j,a[N][N];
scanf("%d",&n);
fun(a,n);
for(i=1;i<=n;i++) {
for(j=1;j<=n;j++)
printf("%d ",a[i][j]);
printf("\n");
}
system("pause");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
void fun(int k,int bb[]) {
int i;
int j=0;
for(i=1;i<=k;i++) {
if(k%i==0&&i%2==0)
bb[j++]=i;
}
for(i=j-1;i>=0;i--)
printf("%d ",bb[i]);
}
int main() {
int x, *t;
scanf("%d", &x);
t = (int *) malloc(sizeof(int)*x);
fun(x,t);
system("pause");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
const int N=4;
void output(char x[], int n);
void paixu(char x[]);
int main() {
char string[N] = {‘2‘,‘0‘,‘1‘,‘9‘};
int i;
printf("排序前: \n");
output(string, N);
printf("\n排序后: \n");
paixu(string);
output(string, N);
printf("\n");
system("pause");
return 0;
}
void output(char x[], int n) {
int i;
for(i=0; i<N; i++)
printf("%c", x[i]);
}
void paixu(char x[])
{
int i,j,t;
for(i=1;i<N;i++)
{
for(j=0;j<N-1;j++)
{
if(x[j]<=x[j+1])
{
t=x[j];
x[j]=x[j+1];
x[j+1]=t;
}
}
}
}
标签:output eal i++ 技术 void 排序 ati png fine
原文地址:https://www.cnblogs.com/uziuzi/p/11973831.html