『壹』 用c語言編程怎樣能夠編出圖片上的圖形
#include<stdio.h>
#include<stdlib.h>
voidmain(){inti,j;
for(i=0;i<9;i++){
for(j=0;j<(N/2-abs(N/2-i)+1);j++)printf("*");
printf(" ");
}
}
『貳』 怎樣用c語言輸出一張圖片
如果圖有規律,那麼利用規律寫一個函數。如果沒有規律,將圖片的每一個像素點的RGB值保存,可以附帶坐標信息,不管是絕對坐標還是相對坐標,然後直接輸出就可以了。
『叄』 c語言中如何導入圖片
1、首先先在圖片取模軟體找到軟體快捷方式,點擊打開軟體。
『肆』 c語言 圖片
1、如果有圖片(例如 wzzx.jpg) 程序中插一句:
system("mspaint wzzx.jpg"); 就可以 在運行時顯示這張圖片。
用字元串變數調用也可以:
char pic_name[80]="wzzx.jpg";
char cmd[100];
sprintf(cmd,"mspaint %s",pic_name);
system(cmd); // 顯示圖片
2、system函數:
原型:int system(const char * command);
功能:執行 dos(windows系統) 或 shell(Linux/Unix系統) 命令,參數字元串command為命令名;
說明:在windows系統中,system函數直接在控制台調用一個command命令。在Linux/Unix系統中,system函數會調用fork函數產生子進程,由子進程來執行command命令,命令執行完後隨即返回原調用的進程;
頭文件:stdlib.h;
返回值:命令執行成功返回0,執行失敗返回-1。
『伍』 c語言接單一般都是什麼項目
一般,IT相關的計算機偏硬體應用的相關開發工作都是C++語言完成。
嵌入式軟體開發,做應用軟體開發,也會用到C++,比如寫個QT上位機工具,這是在很少的情況下會用到,C用於單片機開發,會C語言的話,可以找單片機開發相關的工作,或者做Linux底層驅動開發或者應用軟體開發,這都是可以的。
C語言是面向過程的計算機編譯型程序設計語言。它獨特的兼容性,可移植性,適合底層硬體開發,幾乎兼容所有的操作系統
『陸』 求c語言大神接單😂😂😂,時間快來不及了ԅ
第一題的,寫的有點亂,不過思路都有了
A1 == A2時,Arr[temp]=A1; 這條忘加了
Arr[49]即為第50個數
『柒』 C語言怎麼輸出一張圖片
輸出到文件的話,按照指定圖片格式,寫入文件即可。
電腦型號:微星 GF63 Thin 9SC
系統版本:Microsoft Windows 10
文本文件
1、打開電腦上要讀取的文本文件。
『捌』 如何用c語言讀取圖片
#include
using namespace std;
#define Twoto1(i,j,w) i*w+j
void createimage(unsigned char *&img, int w, int h)
{img = new unsigned char[w*h];}
void delateimage(unsigned char*img)
{delete []img;}
void readimage(unsigned char*img, int w, int h, char *fname)
{
FILE *fp;
fopen_s(&fp,fname, "rb");
if (fp == NULL){ cout << "error" << endl; return; }
size_t result;
result=fread(img , sizeof(unsigned char), w*h, fp);
if (result != w*h)
{
cout << "Reading error" << endl;
return;
}
else
cout << "Reading Ok!" << endl;
fclose(fp);
}
void mobanjuanji(unsigned char image, unsigned char*image1, int w, int h, float moban[5][5])
{
for (int i = 0; i for (int j = 0; j if (iw - 3 || j>h - 3)
image1[Twoto1(i,j,w)] = 0;
else
{
float temp = 0;
for (int m = 0; m<5; m++)
for (int n = 0; n<5; n++)
{
temp += (image[Twoto1(i-2+m,j-2+n,w)] moban[m][n]);
}
if (temp>255) image1[Twoto1(i, j, w)] = 255;
else if (temp<0) image1[Twoto1(i, j, w)] = 0;
else image1[Twoto1(i, j, w)] = temp;
}
}
void saveimage(unsigned char *img, int w, int h, char *fname)
{
FILE *fp;
fopen_s(&fp, fname, "wb");
if (fp == NULL) { cout << "error" << endl; return; }
size_t result;
result = fwrite(img, sizeof(unsigned char), w*h, fp);
if (result != w*h)
{
cout << "Write error" << endl;
return;
}
else
cout << "Write Ok!" << endl;
fclose(fp);
}
void main()
{
unsigned char *img;
unsigned char *img1;
float moban[5][5] = { {0,0,0,0,0},{0, -1, 0, 1, 0 }, { 0, -2, 0, 2, 0 }, { 0, -1, 0, 1, 0 }, { 0,0,0,0,0 } };
//float moban[5][5] = { 0 };
int w = 512, h = 512;
createimage(img, w, h);
createimage(img1, w, h);
readimage(img, w, h, "E:ss.raw");
mobanjuanji(img, img1,w, h, moban);
saveimage(img, w, h, "E:ss_1.raw");
saveimage(img1, w, h, "E:ss_2.raw");
delateimage(img);
delateimage(img1);
}
(8)c語言接單圖片擴展閱讀
C語言實現一個圖片的讀出和寫入
#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;
}
『玖』 用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;
}
(9)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] = '