-
已知數(shù)據(jù)文件IN.dat中存有200個四位數(shù),并已調(diào)用讀函數(shù)rData()把這些數(shù)存入數(shù)組a中,請編寫函數(shù)spellNum(),其功能是:把個位數(shù)字和千位數(shù)字重新組成一個新的二位數(shù)(新二位數(shù)的十位數(shù)字是原四位數(shù)的個位數(shù)字,新二位數(shù)的個位數(shù)字是原四位數(shù)的千位數(shù)字),以及把百位數(shù)字和十位數(shù)字組成另一個新的二位數(shù)(新二位數(shù)的十位數(shù)字是原四位數(shù)的百位數(shù)字,新二位數(shù)的個位數(shù)字是原四位數(shù)的十位數(shù)字),如果新組成的兩個二位數(shù)一個是奇數(shù),另一個為偶數(shù),并且兩個二位數(shù)中至少有一個數(shù)能被17整除,同時兩個新數(shù)的十位數(shù)字均不為0,則將滿足此條件的四位數(shù)按從大到小的順序存入數(shù)組b中,并要計算滿足上述條件的四位數(shù)的個數(shù)count。最后Main()函數(shù)調(diào)用寫函數(shù)wData(),把結(jié)果count以及數(shù)組b中符合條件的四位數(shù)輸出到OUT.dat文件中。
標簽:
200
dat
IN
數(shù)據(jù)文件
上傳時間:
2014-10-29
上傳用戶:李彥東
-
TdcHintEx
Provides your users with a cool transparent hint. It replaces standard Delphi hint window.
Just drop a TdcHintEx in your Main form. Set Enabled to True. And run your application.
Oh btw, please set ShowHint to True.. :)
Drop me a line, and tell me what you think of it.
Antony Hoon
antony7777@telkom.net
標簽:
hint
transparent
TdcHintEx
Provides
上傳時間:
2014-01-12
上傳用戶:181992417
-
PixelFusion.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
PixelFusion.h
This is the Main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CPixelFusionApp application class.
PixelFusion.cpp
This is the Main application source file that contains the application
class CPixelFusionApp.
PixelFusion.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
PixelFusion.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
標簽:
his
brovey
上傳時間:
2015-03-16
上傳用戶:313777423
-
#include <iostream>
using namespace std;
int Main(){
int t;
cin>>t;
while(t--){
long long n;
cin>>n;
if(n%2==1)
cout<<(n*n-1)/4<<endl;
else if (n%4==0)
cout <<(n*n)/4-1<<endl;
else{
if(n==2)
cout<<1<<endl;
else{
long long k=n/2-1;
cout <<k*k+2*k-3<<endl;
}
}
}
return 0;
}
標簽:
天津大學acm4022
代碼
上傳時間:
2015-04-20
上傳用戶:nr607
-
兩個鏈表的交集
#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
int data;
struct Node *next;
}Node;
void initpointer(struct Node *p){
p=NULL;
}
int printlist(struct Node* head){
int flag=1;
head=head->next;
/*
因為標記1的地方你用了頭結(jié)點,所以第一個數(shù)據(jù)域無效,應該從下一個頭元結(jié)點開始
*/
if(head==NULL)
printf("NULL\n");
else
{
while(head!=NULL)
{
if(flag==1)
{
printf("%d",head->data);
flag=0;
}
else
{
printf(" %d",head->data);
}
head=head->next;
}
printf("\n");
}
return 0;
}
struct Node *creatlist(struct Node *head)
{
int n;
struct Node *p1=(struct Node *)malloc(sizeof(struct Node));
p1->next=NULL;
while(scanf("%d",&n),n!=-1)
{
struct Node *pnode=(struct Node *)malloc(sizeof(struct Node));
pnode->next=NULL;
pnode->data=n;
if(head==NULL)
head=pnode;
p1->next=pnode;
p1=pnode;
}
return head;
}
struct Node *Intersect(struct Node *head1, struct Node *head2)
{
struct Node *p1=head1,*p2=head2;/*我這里沒有用頭指針和頭結(jié)點,這里是首元結(jié)點head1里面就是第一個數(shù)據(jù),一定要理解什么事頭指針,
頭結(jié)點,和首元結(jié)點
具體你一定要看這個博客:http://blog.sina.com.cn/s/blog_71e7e6fb0101lipz.html*/
struct Node *head,*p,*q;
head = (struct Node *)malloc(sizeof(struct Node));
head->next = NULL;
p = head;
while( (p1!=NULL)&&(p2!=NULL) )
{
if (p1->data == p2->data)
{
q = (struct Node *)malloc(sizeof(struct Node));
q->data = p1->data;
q->next = NULL;
p->next = q;//我可以認為你這里用了頭結(jié)點,也就是說第一個數(shù)據(jù)域無效 **標記1**
p = q;
p1 = p1->next;
p2 = p2->next;
}
else if (p1->data < p2->data)
{
p1 = p1->next;
}
else
{
p2 = p2->next;
}
}
return head;
}
int Main()
{
struct Node *head=NULL,*headt=NULL,*t;
//initpointer(head);//這里的函數(shù)相當于head=NULL;
// initpointer(headt);//上面已經(jīng)寫了headt=NULL那么這里可以不用調(diào)用這個函數(shù)
head=creatlist(head);
headt=creatlist(headt);
t=Intersect(head,headt);
printlist(t);
}
標簽:
c語言編程
上傳時間:
2015-04-27
上傳用戶:coco2017co
-
1.此代碼基于紅牛開發(fā)板,請根據(jù)自己的板子進行修改。
2.通過修改網(wǎng)上的代碼實現(xiàn),修改前的功能開了一個很大的緩存接收app數(shù)據(jù),然后一次性全部數(shù)據(jù)寫入,
但是這個在實際應用中沒多大用,所以修改為一次寫入128個字節(jié)。
3.程序flash的偏移地址為0x8010000,所以app編譯前應該在mdk中設(shè)置
Option窗口->Target頁->IROM1,start 改為 0x8010000
4.設(shè)置中斷向量重映射,我用的方法是在app端的Main函數(shù)起始位置添加語句
SCB->VTOR = FLASH_BASE | 0x10000;
5.啟動時如果發(fā)現(xiàn)沒有app,會進入bootloader模式(燈全亮),如果發(fā)現(xiàn)有程序就要看程序的功能了。
如果有app,但是又想重新升級的話就按住某個鍵(我這里是Tamper),然后按復位,松開復位之前不要松開
按鍵,這樣就會進入bootloader模式。
6.進入bootloader后通過串口1接收升級app數(shù)據(jù),bin文件數(shù)據(jù),接收完成后按User1鍵進行升級操作,完成后
復位或者按User2鍵可以運行剛寫入的app。
標簽:
stm32
iap
上傳時間:
2015-05-18
上傳用戶:llma2017
-
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
Main(void)
{ char new_name[4], name[4];
int new_sn ,sn;
printf(" 【注冊】\n\n");
printf("請輸入用戶名(四位英文字母):");
scanf("%s", &new_name);
printf("請輸入密碼(六位數(shù)字):") ;
scanf("%d" ,&new_sn);
/*system("PAUSE");*/
system("CLS");/*清屏*/
/*system("PAUSE");*/
printf(" 【登陸】\n\n");
printf("輸入用戶名:");
scanf("%s" , &name);
if(!strcmp(new_name,name)){printf("輸入用戶名錯誤!"); }/*判斷用戶是否正確*/
printf("輸入密碼:");
scanf("%d" , &sn);
if(new_sn != sn){printf("輸入密碼錯誤!"); }/*判斷密碼是否正確*/
system("CLS");
printf("恭喜你,登陸成功!\n");
getchar();
return 0;
}
標簽:
C語言
上傳時間:
2015-12-30
上傳用戶:gjatd1987
-
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uint i,j;
sbit dula=P2^6;
sbit wela=P2^7;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,
0x7d,0x07,0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void Main()
{
j=0;
i=0;
TMOD=0X01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
EA=1;
ET0=1;
TR0=1;
while(1);
}
void time0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
i++;
if(i==15)
{
P0=table[j];
dula=1;
dula=0;
P0=0XC0;
wela=1;
wela=0;
j++;
i=0;
if(j==16)
{
j=0;
}
}
}
標簽:
用定時器以間隔500MS在6位數(shù)碼管上依次顯示0、1、 2、3….C、D、E、F,重復。
上傳時間:
2016-02-11
上傳用戶:嬌縱Pamper
-
/****************************************************************
外部晶振8M
PA0~3:四位數(shù)碼管的位選
PB0~7:數(shù)碼管的8位段選
外部中斷0用于計數(shù)
定時器0溢出中斷的定時為1ms
說明 :檢測到水流較小時,繼電器延時1秒關(guān)閉
******************************************************************/
#include<iom16v.h>
#include<macros.h>
#define uchar unsigned char
#define uint unsigned int
char led_7[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; //數(shù)碼管段選
char position[4]={0xfe,0xfd,0xfb,0xf7};//數(shù)碼管位選
uint sumnum=0; //用于記錄1000ms內(nèi)進入中斷的次數(shù)
uint time=0; //記錄進入比較定時器0的次數(shù)
uint num=0; //記錄1ms內(nèi)進入中斷的次數(shù)
uint count=0; //進入外部中斷0的次數(shù)
uchar flag;
uint sumnum1; //記錄100ms內(nèi)的數(shù)目
/***************************函數(shù)聲明***************************/
void delay();
void display(uint m );
void init();
void init_0();
void init_2();
void _delay_us(uint l)
{
unsigned int i;
for(i=0;i<l;i++)
{
asm("nop");
}
}
/**************************主函數(shù)***********************************/
void Main()
{
init();
init_0();
init_2();
while(sumnum<5)
{
PORTD=0XBF;
segdisplay(sumnum1);
}
while(1)
{
segdisplay(sumnum1);
}
}
/*************************掃描數(shù)碼管時的延時函數(shù)*********************/
void delay()
{
uchar i,j;
for(i=6;i>0;i--)
for(j=225;j>0;j--);
}
/************************數(shù)碼管顯示函數(shù)*****************************/
void segdisplay( int temp)
{
int seg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int temp1,temp2,temp3,temp4;
temp1=temp/1000;
temp2=(temp/100)%10;
temp3=(temp/10)%10;
temp4=temp%10;
DDRB=0xff;
DDRA|=0x0f;
PORTA=~BIT(3);
PORTB=seg[temp1];
_delay_us(100);
PORTA=~BIT(2);
PORTB=seg[temp2];
_delay_us(100);
PORTA=~BIT(1);
PORTB=seg[temp3];
_delay_us(100);
PORTA=~BIT(0);
PORTB=seg[temp4];
_delay_us(100);
}
/***********************管腳初始化函數(shù)*********************/
void init()
{
DDRD|=0X40; //PD4 設(shè)置為輸出
PORTD=0XBF;
DDRA=0XFF;
DDRB=0XFF;
PORTA=0XFF;
PORTB=0XFF;
}
/***********************外部中斷0初始化*********************/
void init_0()
{
MCUCR=0X02; //INT0為下降沿觸發(fā)
GICR=0X40; //使能INT0中斷
SREG=0X80; //使能總中斷
}
/**********************定時器2初始化***********************/
void init_2()
{
TCCR0=0x03; // 內(nèi)部時鐘,64 分頻(8M/64=125KHz)
TCNT0=0x83; //裝初值
TIMSK=0x01; // 允許 T/C0溢出中斷中斷
}
/***********************外部中斷0子函數(shù)********************/
#pragma interrupt_handler int0_isr:2
void int0_isr(void)
{
count++;
}
/*********************定時計數(shù)器0溢出中斷子函數(shù)*****************/
#pragma interrupt_handler int0_over:10
void int0_over(void)
{
TCNT0=0x83; //重裝初值
if((time%100) == 0)
sumnum1 = num;
if(time == 1000)
{
sumnum=num;
if(sumnum<10)
{
if((flag==1)&&(sumnum<10))
{
PORTD=0XFF;
flag=0;
}
flag++;
}
else
PORTD=0XBF;
num=0;
time=0;
}
num+=count;
count=0;
++time;
}
標簽:
C語言
上傳時間:
2016-03-09
上傳用戶:彥 yan
-
#include <iostream>
using namespace std;
class Student
{
public:
Student(int, int);
int num;
int grade;
};
Student::Student(int n, int g)
{
num = n;
grade = g;
}
int maxGradeIndex(Student* s)
{
int maxGrade, index = 0, i = 0;
maxGrade = s[0].grade;
for (i = 0; i<5; i++)
{
if (s[i].grade > maxGrade)
{
maxGrade = s[i].grade;
index = i;
}
}
return index;
}
int Main()
{
Student a[5] = { Student(1, 86), Student(2, 60), Student(3, 72), Student(4, 95), Student(5, 66) };
int maxGradeStNum = maxGradeIndex(a);
cout << "成績最好學生的學號是:" << a[maxGradeStNum].num << endl;
cout << "成績最好學生的成績是:" << a[maxGradeStNum].grade << endl;
getchar();
return 0;
}
標簽:
c語言
程序
上傳時間:
2016-04-23
上傳用戶:burt1025