#include <stdio.h> #include <stdlib.h> #define SMAX 100 typedef struct SPNode { int i,j,v; }SPNode; struct sparmatrix { int rows,cols,terms; SPNode data [SMAX]; }; sparmatrix CreateSparmatrix() { sparmatrix A; printf("\n\t\t請輸入稀疏矩陣的行數,列數和非零元素個數(用逗號隔開):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t輸入非零元素值(格式:行號,列號,值):"); scanf("%d,%d,%d",&A.data[n].i,&A.data[n].j,&A.data[n].v); } return A; } void ShowSparmatrix(sparmatrix A) { int k; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { k=0; for(int n=0;n<=A.terms-1;n++) { if((A.data[n].i-1==x)&&(A.data[n].j-1==y)) { printf("%8d",A.data[n].v); k=1; } } if(k==0) printf("%8d",k); } printf("\n\t\t"); } } void sumsparmatrix(sparmatrix A) { SPNode *p; p=(SPNode*)malloc(sizeof(SPNode)); p->v=0; int k; k=0; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { for(int n=0;n<=A.terms;n++) { if((A.data[n].i==x)&&(A.data[n].j==y)&&(x==y)) { p->v=p->v+A.data[n].v; k=1; } } } printf("\n\t\t"); } if(k==1) printf("\n\t\t對角線元素的和::%d\n",p->v); else printf("\n\t\t對角線元素的和為::0"); } int Main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t 稀疏矩陣的三元組系統 "); printf("\n\t\t*********************************"); printf("\n\t\t 1------------創建 "); printf("\n\t\t 2------------顯示 "); printf("\n\t\t 3------------求對角線元素和"); printf("\n\t\t 4------------返回 "); printf("\n\t\t*********************************"); printf("\n\t\t請選擇菜單號(0-3):"); scanf("%d",&choice); switch(choice) { case 1: A=CreateSparmatrix(); break; case 2: ShowSparmatrix(A); break; case 3: SumSparmatrix(A); break; default: system("cls"); printf("\n\t\t輸入錯誤!請重新輸入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }
上傳時間: 2020-06-11
上傳用戶:ccccy
#include<iostream> using namespace std; int s=0; int prime(int x){ int i,p=1; for(i=2;i<=x/2;i++){ if(x%i==0){ p=0; break; } } if(p!=0){ cout<<x<< " "; s++; } } int Main(){ for (int k=5;k<=100;k++){ prime(k); if(s%5==0) cout<<'\n'; } return 0; }
標簽: C++
上傳時間: 2020-06-30
上傳用戶:1274636550
)Armature windings of the electric motor for NO.2 deck cargo winch found low insulation. Windings re-winded,painted and baked dry. (2) NO.1 Main air compressor failed to build up pressure.The machine disassembled, cleaned and inspected. The discharge valve plate found broken. The valve palte renewed and running trials tested after being reassembled.
標簽: 答案
上傳時間: 2020-07-14
上傳用戶:
STM32F407VGT6精確脈沖控制步進電機源碼,采用STM32F407VGT6芯片,拋棄單脈沖輸出方式,直接使用普通PWM輸出方式精確輸出脈沖個數,每個脈沖都可以改變頻率和占空比。PWM+中斷,簡單粗暴。#include "sys.h"#include "delay.h"#include "pwm1.h"#include "pwm2.h"#include "pwm3.h"//注釋見pwm1.c文件extern int count2;int Main(void){ delay_init(168); //初始化延時函數 TIM2_Init(1,167); TIM3_Init(1,167); TIM5_Init(1,167); // delay_ms(1000); TIM2_OUTPUT(); TIM3_OUTPUT(); TIM5_OUTPUT(); while(1) { //TIM2每次輸出完10個脈沖后間隔100ms再次輸出 if(count2 >= 10){ delay_ms(100); TIM2_OUTPUT(); } }
標簽: stm32f407vgt6 脈沖控制 步進電機
上傳時間: 2021-10-26
上傳用戶:xsr1983
C語言各知識點詳細總結27頁C 語言知識要點復習資料 總體上必須清楚的: 1)程序結構是三種: 順序結構 、選擇結構(分支結構)、循環結構。 2)讀程序都要從 Main()入口, 然后從最上面順序往下讀(碰到循環做循環,碰到選擇做選擇),有 且只有一個 Main 函數。 3)計算機的數據在電腦中保存是以 二進制的形式. 數據存放的位置就是 他的地址. 4)bit 是位 是指為 0 或者 1。 byte 是指字節, 一個字節 = 八個位. 概念??嫉降模? 1、編譯預處理不是 C 語言的一部分,不占運行時間,不要加分號。C 語言編譯的程序稱為源程 序,它以 ASCII 數值存放在文本文件中。 2、define PI 3.1415926; 這個寫法是錯誤的,一定不能出現分號。 3、每個 C 語言程序中 Main 函數是有且只有一個。 4、在函數中不可以再定義函數。 5、算法:可以沒有輸入,但是一定要有輸出。 6、break 可用于循環結構和 switch 語句。 7、逗號運算符的級別最低,賦值的級別倒數第二。 第一章 C 語言的基礎知識 第一節、對 C 語言的基礎認識 1、C 語言編寫的程序稱為源程序,又稱為編
標簽: C語言
上傳時間: 2021-11-06
上傳用戶:kent
include<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; 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 display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void Main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; } include<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; 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 display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void Main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; } include<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; 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 display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void Main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; }
標簽: 矩陣式鍵盤
上傳時間: 2021-12-18
上傳用戶:2590813506
PW2330 develops a high efficiency synchronous step down DC-DC converter capable of delivering3A output current. PW2330 operates over a wide input voltage range from 4.5V to 30V andintegrates Main switch and synchronous switch with very low RDS(ON) to minimize the conductionloss. PW2330 adopts the proprietary instant PWM architecture to achieve fast transient responsesfor high step down applications and high efficiency at light loads. In addition, it operates atpseudo-constant frequency of 500kHz under continuous conduction mode to minimize the size ofinductor and capacitor
標簽: pw2330
上傳時間: 2022-02-11
上傳用戶:
PW2205 develops a high efficiency synchronous step-down DC-DC converter capable of delivering5A output current. PW2205 operates over a wide input voltage range from 4.5V to 30V andintegrates Main switch and synchronous switch with very low RDS(ON) to minimize the conductionloss.PW2205 adopts the instant PWM architecture to achieve fast transient responses for high step downapplications and high efficiency at light loads. In addition, it operates at pseudo-constant frequencyof 500kHz under continuous conduction mode to minimize the size of inductor and capacitor
標簽: pw2205
上傳時間: 2022-02-11
上傳用戶:
The PW2163 is a high efficiency 500 kHz synchronous step-down DC-DC converter capable ofdelivering 3A current. The PW2163 operates over a wide input voltage range from 4.5V to 18V andintegrates Main switch and synchronous switch with very low RDS(ON) to minimize the conductionloss. Low output voltage ripple and small external inductor and capacitor sizes are achieved with 500kHz switching frequency. It adopts the instant PWM architecture to achieve fast transient responsesfor high step down applications
標簽: pw2163
上傳時間: 2022-02-11
上傳用戶:
Agilent 34401A Service Guide.pdfIEC Measurement Category II includes electrical devices connected to Mains at an outlet on a branch circuit. Such devices include most small appliances, test equipment, and other devices that plug into a branch outlet or socket. The 34401A may be used to make measurements with the HI and LO inputs connected to Mains in such devices, or to the branch outlet itself (up to 300 VAC). However, the 34401A may not be used with its HI and LO inputs connected to Mains in permanently installed electrical devices such as the Main circuit-breaker panel, sub-panel disconnect boxes, or permanently wired motors. Such devices and circuits are subject to overvoltages that may exceed the protection limits of the 34401A. Note: Voltages above 300 VAC may be measured only in circuits that are isolated from Mains. However, transient overvoltages are also present on circuits that are isolated from Mains. The Agilent 34401A are designed to safely withstand occasional transient overvoltages up to 2500 Vpk. Do not use this equipment to measure circuits where transient overvoltages could exceed this level. Additional Notices Waste Electrical and Electronic Equipment (WEEE) Directive 2002/96/EC This product complies with the WEEE Directive (2002/96/EC) marking requirement. The affixed product label (see below) indicates that you must not discard this electrical/electronic product in domestic household waste. Product Category: With reference to the equipment types in the WEEE directive Annex 1, this product is classified as a "Monitoring and Control instrumentation" product. Do not dispose in domestic household waste. To return unwanted products, contact your local Agilent office, or see www.agilent.com/environment/product for more information. Agilent 34138A Test Lead Set The Agilent 34401A is compatible with the Agilent 34138A Test Lead Set described below. Test Lead Ratings Test Leads - 1000V, 15A Fine Tip Probe Attachments - 300V, 3A Mini Grabber Attachment - 300V, 3A SMT Grabber Attachments - 300V, 3A Operation The Fine Tip, Mini Grabber, and SMT Grabber attachments plug onto the probe end of the Test Leads. Maintenance If any portion of the Test Lead Set is worn or damaged, do not use. Replace with a new Agilent 3413
標簽: agilent
上傳時間: 2022-02-20
上傳用戶: