原創編程
㈠ 電腦編程有哪些
我簡單說說吧,也不去找資料了。
編程像最簡單的有basic,我學編程就是從這開始的,是翻譯表達,也就是說程序使一句語句通過翻譯而執行的。
c語言你一定聽過,使要先通過編譯生成可執行程序,說白了就是機器語言,由0和1組成,由CPU執行。
像vb.vc都是編程環境,在這些環境下可以方便編程。
像網頁腳本語言,也是翻譯執行的,由瀏覽器翻譯執行。
好多好多,由興趣你再上網查查。編程很有意思!
我說老哥,再加點分好不。
參考資料:原創
㈡ 求一個C++編程,繼承與派生。救急啊!!!要原創的啊!!!
#include<iostream>
using namespace std;
#include<math.h>
class Shape//抽象類,公共基類
{
public:
virtual double Area()const=0;//計算各對象面積
virtual double Perim()const=0;//計算各對象周長
virtual void Show()=0;//輸出各對象面積和周長
};
class Rectangle:public Shape//矩形類
{
private:
double Length;//長
double Width;//寬
public:
Rectangle(double Length=0,double Width=0)//構造函數
{
this->Length=Length;
this->Width=Width;
}
~Rectangle()//析構函數
{
}
double Area() const//矩形面積
{
return Length*Width;
}
double Perim() const//矩形周長
{
return 2*(Length+Width);
}
void Show()//輸出矩形面積和周長
{
cout<<"Area is:"<<Area()<<endl;
cout<<"Perim is:"<<Perim()<<endl<<endl;
}
};
const double PI=3.14159;
class Circle:public Shape//圓類
{
private:
double Radius;//圓的半徑
public:
Circle(double Radius=0)//構造函數
{
this->Radius=Radius;
}
~Circle()//析構函數
{
}
double Area() const//圓面積
{
return PI*Radius*Radius;
}
double Perim() const//圓周長
{
return 2*PI*Radius;
}
void Show()//輸出圓的面積和周長
{
cout<<"Area is:"<<Area()<<endl;
cout<<"Perim is:"<<Perim()<<endl<<endl;
}
};
class Triangle:public Shape//三角形類
{
private:
double A,B,C;//三角形三邊
public:
Triangle(double A=0,double B=0,double C=0)//構造函數
{
this->A=A;
this->B=B;
this->C=C;
}
~Triangle()//析構函數
{
}
double Area() const//三角形面積
{
double P;
P=(A+B+C)/2;
return sqrt(P*(P-A)*(P-B)*(P-C));
}
double Perim() const//三角形周長
{
return (A+B+C);
}
void Show()//輸出三角形面積和周長
{
cout<<"Area is:"<<Area()<<endl;
cout<<"Perim is:"<<Perim()<<endl<<endl;
}
};
void main()
{
double Length,Width,Radius,A,B,C;
cout<<"Rectangle:"<<endl;
cout<<"請輸入矩形的長和寬(Length,Width):"<<endl;
cin>>Length>>Width;
Rectangle Rect(Length,Width);//建立矩形對象
Rect.Show();//調用矩形類的輸出函數
cout<<"Circle:"<<endl;
cout<<"請輸入圓形的半徑(Radius):"<<endl;
cin>>Radius;
Circle Cir(Radius);//建立圓對象
Cir.Show();//調用圓類的輸出函數
cout<<"Triangle:"<<endl;
loop:cout<<"請輸入三角形的三邊(A,B,C):"<<endl;
cin>>A>>B>>C;
if(A<=0||B<=0||C<=0||(A+B)<=C||(A+C)<=B||(B+C)<=A)//判斷是否能構成三角形
{
cout<<"輸入的三邊值不能構成一個三角形!請重新輸入!"<<endl;
goto loop;
}
else
{
Triangle Tri(A,B,C);//建立三角形對象
Tri.Show();//調用三角形輸出函數
}
}
㈢ python比較倆數字的大小
python比較兩個數字的大小,可以使用if判斷來進行
def compare(a,b):
if a > b:
print a, ">", b
elif a == b:
print a, "=", b
elif a < b:
print a, "<", b
㈣ 新冠抗疫編程游戲的原創部分指的是什麼
防疫編程。
防疫編程是游戲使用娛樂的形式傳遞防疫信息的自主創意,所以新冠抗疫編程游戲的原創部分指的是防疫編程。
編程是編定程序的中文簡稱,就是讓計算機代碼解決某個問題,對某個計算體系規定一定的運算方式,使計算體系按照該計算方式運行,並最終得到相應結果的過程。為了使計算機能夠理解人的意圖,人類就必須將需解決的問題的思路、方法和手段通過計算機能夠理解的形式告訴計算機,使得計算機能夠根據人的指令去工作,完成某種特定的任務。這種人和計算體系之間交流的過程就是編程。
㈤ 關於用C語言編程,高分求教最簡單程序。
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#define LEN sizeof(struct scorenode)
#define DEBUG
#include <string.h>
struct scorenode
{int number;/*學號*/
char name[10];/*姓名*/
float yuwen;/*語文成績*/
float yingyu;/*英語成績*/
float shuxue;/*數學成績 */
struct scorenode *next;
};
typedef struct scorenode score;
int n,k;/*n,k為全局變數,本程序中的函數均可以使用它*/
/*==============================================================================================*/
score *creat2311(void)
/*函數creat2311,功能:創建鏈表,此函數帶回一個指向鏈表頭的指針*/
{
score*head;
score *p1,*p2,*p3,*max;
int i,j;
float fen;
char t[10];
n=0;
p1=p2=p3=(score *)malloc(LEN);head=p3; /*開辟一個新單元*/
printf("請輸入學生資料,輸0退出!\n");
repeat1: printf("請輸入學生學號(學號應大於0):");/*輸入學號,學號應大於0*/
scanf("%d",&p1->number);
while(p1->number<0)
{getchar();
printf("輸入錯誤,請重新輸入學生學號:");
scanf("%d",&p1->number);}
/*輸入學號為字元或小於0時,程序報錯,提示重新輸入學號*/
if(p1->number==0)
goto end;/*當輸入的學號為0時,轉到末尾,結束創建鏈表*/
else
{
p3=head;
if(n>0)
{for(i=0;i<n;i++)
{if(p1->number!=p3->number)
p3=p3->next;
else
{printf("學號重復,請重輸!\n");
goto repeat1;
/*當輸入的學號已經存在,程序報錯,返回前面重新輸入*/
}
}
}
}
printf("請輸入學生姓名:");
scanf("%s",&p1->name);/*輸入學生姓名*/
printf("請輸入語文成績(0~100):");/*輸入語文成績,成績應在0-100*/
scanf("%f",&p1->yuwen);
while(p1->yuwen<0||p1->yuwen>100)
{getchar();
printf("輸入錯誤,請重新輸入語文成績");/*輸入錯誤,重新輸入語文成績直到正確為止*/
scanf("%f",&p1->yuwen);}
printf("請輸入英語成績(0~100):");/*輸入英語成績,成績應在0-100*/
scanf("%f",&p1->yingyu);
while(p1->yingyu<0||p1->yingyu>100)
{getchar();
printf("輸入錯誤,請重新輸入英語成績");/*輸入錯誤,重新輸入英語成績直到正確為止*/
scanf("%f",&p1->yingyu);}
printf("請輸入數學成績(0~100):");/*輸入數學成績,成績應在0-100*/
scanf("%f",&p1->shuxue);
while(p1->shuxue<0||p1->shuxue>100)
{getchar();
printf("輸入錯誤,請重新輸入數學成績");
scanf("%f",&p1->shuxue);}/*輸入錯誤,重新輸入數學成績直到正確為止*/
head=NULL;
while(p1->number!=0)
{
n=n+1;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(score *)malloc(LEN);
printf("請輸入學生資料,輸0退出!\n");
repeat2:printf("請輸入學生學號(學號應大於0):");
scanf("%d",&p1->number);/*輸入學號,學號應大於0*/
while(p1->number<0)
{getchar();
printf("輸入錯誤,請重新輸入學生學號:");
scanf("%d",&p1->number);}
/*輸入學號為字元或小於0時,程序報錯,提示重新輸入學號*/
if(p1->number==0)
goto end;/*當輸入的學號為0時,轉到末尾,結束創建鏈表*/
else
{
p3=head;
if(n>0)
{for(i=0;i<n;i++)
{if(p1->number!=p3->number)
p3=p3->next;
else
{printf("學號重復,請重輸!\n");
goto repeat2;
/*當輸入的學號已經存在,程序報錯,返回前面重新輸入*/
}
}
}
}
printf("請輸入學生姓名:");
scanf("%s",&p1->name);/*輸入學生姓名*/
printf("請輸入語文成績(0~100):");
scanf("%f",&p1->yuwen);/*輸入語文成績,成績應在0-100*/
while(p1->yuwen<0||p1->yuwen>100)
{getchar();
printf("輸入錯誤,請重新輸入語文成績");
scanf("%f",&p1->yuwen);}/*輸入錯誤,重新輸入語文成績直到正確為止*/
printf("請輸入英語成績(0~100):");
scanf("%f",&p1->yingyu);/*輸入英語成績,成績應在0-100*/
while(p1->yingyu<0||p1->yingyu>100)
{getchar();
printf("輸入錯誤,請重新輸入英語成績");
scanf("%f",&p1->yingyu);}/*輸入錯誤,重新輸入英語成績直到正確為止*/
printf("請輸入數學成績(0~100):");
scanf("%f",&p1->shuxue);/*輸入數學成績,成績應在0-100*/
while(p1->shuxue<0||p1->shuxue>100)
{getchar();
printf("輸入錯誤,請重新輸入數學成績");
scanf("%f",&p1->shuxue);}/*輸入錯誤,重新輸入數學成績直到正確為止*/
}
本文來自: 乘風原創程序(http://www.qqcf.com) 詳細出處參考:http://study.qqcf.com/web/174/20462.htm
㈥ 手機編程軟體推薦
手機編程軟體推薦
1、《Python編程獅》
這是一款非常適合編程小白用戶使用的入門工具,可以幫助初學者快速進入到編程的世界中。這裡麵包含有海量的編程參考教程,可以讓大家在碎片時間充分進行練習,並且能夠在手機端書寫簡單的代碼,可以邊學邊練。
㈦ 速度求個100行的C語言編程,不限內容~ 要求原創
#include<stdlib.h>
#define MAX 100
struct addr{
char name[30];
char street[40];
char city[20];
char state[3];
unsigned long int zip;
}add_list[MAX];
void init_list(void),enter(void);
void delete(void),list(void);
void load(void),save(void);
int menu_select(void),find_free(void);
int main(void)
{
char choice;
init_list();/*initialize the structure array*/
for(;;){
choice=menu_select();
switch(choice){
case 1:enter();
break;
case 2:delete();
break;
case 3:list();
break;
case 4:save();
break;
case 5:load();
break;
case 6:exit(0);
}
}
return 0;
}
/*Initialize the list*/
void init_list(void)
{
register int t;
for(t=0;t<MAX;++t)
add_list[t].name[0]='0';
}
/*Get a menu selection*/
int menu_select(void)
{
char s[80];
int c;
printf("1.Enter a name\n");
printf("2.Delete a name\n");
printf("3.List the file\n");
printf("4.Save the file\n");
printf("5.Load the file\n");
printf("6.Quit\n");
do{
printf("\nEnter your choice:");
gets(s);
c=atoi(s);
}while(c<0||c>6);
return c;
}
/*Input addresses into the list*/
void enter(void)
{
int slot;
char s[80];
slot=find_free();
if(slot==-1){
printf("\nList Full");
return;
}
printf("Enter name:");
gets(add_list[slot].name);
printf("Enter street:");
gets(add_list[slot].street);
printf("Enter city:");
gets(add_list[slot].city);
printf("Enter state:");
gets(add_list[slot].state);
printf("Enter zip:");
gets(s);
add_list[slot].zip=strtoul(s,'\0',10);
}
/*Find an unused structure*/
int find_free(void)
{
register int t;
for(t=0;add_list[t].name[0]&&t<MAX;++t);
if(t==MAX)
return -1;/*no slots free*/
return t;
}
/*Delete an address*/
void delete(void)
{
register int slot;
char s[80];
printf("enter record # :");
gets(s);
slot=atoi(s);
if(slot>=0&&slot<MAX)
add_list[slot].name[0]='\0';
}
/*Display the list on the screen*/
void list(void)
{
register int t;
for(t=0;t<MAX;++t){
if(add_list[t].name[0]){
printf("%s\n",add_list[t].name);
printf("%s\n",add_list[t].street);
printf("%s\n",add_list[t].city);
printf("%s\n",add_list[t].state);
printf("%s\n",add_list[t].zip);
}
}
printf("\n\n");
}
/*Save the list*/
void save(void)
{
FILE *fp;
register int i;
if((fp=fopen("maillist","wb"))==NULL)
printf("Cannot open file\n");
return;
for(i=0;i<MAX;i++)
if(*add_list[i].name)
if(fwrite(&add_list[i],sizeof(struct addr),1,fp)!=1)
printf("File write error\n");
fclose(fp);
}
/*Load the file*/
void load(void)
{
FILE *fp;
register int i;
if((fp=fopen("maillist","rb"))==NULL){
printf("Cannot open file\n");
return;
}
init_list();
for(i=0;i<MAX;i++)
if(fread(&add_list[i],sizeof(struct addr),1,fp)!=1){
if(feof(fp))break;
printf("File read error\n");
}
fclose(fp);
}
㈧ 緊急!C語言編程!50分!要求通過驗證且原創!
這個問題可大可小,說大可以做成文本編輯器軟體,說小就當做個編程練習,下面的代碼還行,有一定實用價值。小可這里有400多行的文本編輯器程序也有數千行的程序,比較大就不發了。
程序當然可以處理漢字或特殊字元,我都在vc2005/dev-c++編譯運行通過,結果令人滿意。
/*文件字元串(包括漢字和特殊字元等)查找替換實用程序,簡練有效*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 10000 /* 設定文件最大字元個數不超過10000,可更改 */
int main()
{
int i=0,j,k=0,m=0,pos=0,max,len1,len2;
char s[N],t[N],a[200],s1[200],s2[200];
FILE *fp;
printf("Please input file name:\n");/*輸入文件名*/
gets(a);
printf("Please input original string:\n");/*輸入要替換的字元串*/
gets(s1);
printf("Please input new string:\n");/*輸入被替換成的字元串*/
gets(s2);
len1=strlen(s1);
len2=strlen(s2);
if ((fp=fopen(a,"r"))==NULL)/*設定文件位於當前目錄下,可更改為絕對路徑*/
{ printf("Open file %s error! Strike any key to exit!",a);
system("pause");
exit(1);
}
s[i++]=fgetc(fp);
while(!feof(fp))
{s[i++]=fgetc(fp);
}
fclose(fp);
max=i-1;/* 函數feof()最後會讀兩次,所以必須減1 */
for(i=0;i<max-len1;i++)
{for(j=0;j<len1&&(s[i+j]==s1[j]);j++);
if(j!=len1)
continue;/* 不相等則i加1進行下一次外循環 */
else
{ for(k=0;k<i-pos;k++)/* pos記錄開始復制的位置 */
t[m++]=s[pos+k];
pos=i+len1;
for(k=0;k<len2;k++)/* 字元串替換 */
t[m++]=s2[k];
}
}
for(k=pos;k<max;k++)/* 復制剩餘字元 */
t[m++]=s[k];
max=m;/* max是替換後文件的字元總數 */
fp=fopen(a,"w");
printf("\n\nThe results are:\n\n");
for(j=0;j<max;j++)
{putchar(t[j]); /* 結果顯示到屏幕 */
fputc(t[j],fp); /* 同時結果寫入到當前目錄下的新文件001.txt中 */
}
printf("\n\n");
fclose(fp);
system("pause");
return 0;
}
㈨ 編程c語言 原創!!
#include <stdio.h>
#include <string.h>
#include "math.h"
double len(int n)
{
if(n==6)
return 1.0;
double x=len(n>>1)/2;
return sqrt(2.0f-2.0f*sqrt(1-x*x));
}
double calPI(int n)
{
return len(n)*n/2;
}
int main(void)
{
int num = 6;
double pi0 = 0.0f,pi1 = 0.0f;
for(;;)
{
pi1 = calPI(num);
if (fabs(pi1 - pi0) < 1e-14) //兩次計算結果小於10的-14次方
break;
printf("邊數為%d時,pi= %15.14f\n",num, pi1);
num *= 2;
pi0 = pi1;
}
return 0;
}
㈩ 求大神編程:編出一個小軟體,我要代碼~(原創的,用c++語言編寫)
需要什麼功能的軟體,說個大概方向,控制台的還是桌面的,可以發私信給我