『壹』 c语言for循环打印图片
#include<stdio.h>
void main()
{
int n=5,i,k,j;
// scanf("%d",&n);
for(i=1;i<=n;++i)
{
for(k=1;k<=n-i;++k)
printf(" ");
for(j=1;j<=2*i-1;++j)
{
printf("*");
}
printf("\n");
}
for(i=n-1;i>0;i--)
{
for(k=n-i;k>0;k--)
printf(" ");
for(j=1;j<=2*i-1;++j)
{
printf("*");
}
printf("\n");
}
}
这个应该可以满足你的要求。
『贰』 用c语言打印图案
main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5-2*abs(i-3);j++)
printf("*");
printf("\n");
}
}
调试过的程序!!!行
tc2.0怎么给你
『叁』 一个C语言程序,将文件中的图案打印出来,
在文本里读入一行
然后再屏幕上输出一行?
『肆』 用c语言如何读取和保存jpg图片文件
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int file_size(char* filename)//获取文件名为filename的文件大小。
{
FILE *fp = fopen(filename, "rb");//打开文件。
int size;
if(fp == NULL) // 打开文件失败
return -1;
fseek(fp, 0, SEEK_END);//定位文件指针到文件尾。
size=ftell(fp);//获取文件指针偏移量,即文件大小。
fclose(fp);//关闭文件。
return size;
}
int main ()
{
int size=0;
size=file_size("qw");
printf("%d ",size);
FILE * pFile,*qw;
char *buffer=(char*)malloc(sizeof(char)*size);
qw =fopen("qw","r");
pFile = fopen ( "qwe" , "wb" );
printf("%d== ",pFile);
printf("%d ",size);
fread(buffer,1,size,qw);
fwrite (buffer , sizeof(byte), size , pFile );
fclose (pFile);
rename("qwe","Groot.jpg");
return 0;
}
(4)c打印图片文件扩展阅读:
c语言读取TXT文件:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE 1024
int main()
{
char buf[MAX_LINE]; /*缓冲区*/
FILE *fp; /*文件指针*/
int len; /*行字符个数*/
if((fp = fopen("test.txt","r")) == NULL)
{
perror("fail to read");
exit (1) ;
}
while(fgets(buf,MAX_LINE,fp) != NULL)
{
len = strlen(buf);
buf[len-1] = '