排行榜

  • 用户榜
  • 标签榜
  • 冲榜分奖金

频道

最新最热悬赏待采纳 筛选
  • 1

    回答

  • 17

    浏览

我在附加库里添加了三个库文件  然后显示这个无法打开 !include 'make.inc' !integer :: ntime=98 !integer :: nstation=15 !integer :: nestedPer=2 !integer :: nmodes=2 !real :: TSER(ntime,nstation)=v_pn !real :: msgOrig=100 !real :: CSEOF(nmodes,nestedPer,nstation) !real :: cseofScale=1 !real :: PCTS(nmodes,ntime) !real :: PCVAR(nmodes) !include 'blas_win32.lib' !download from the PAPACK(lapack) library , for Subroutine SSYEV !include 'lapack_win32.lib' !include 'tmglib_win32.lib' call CYCLOSTATIONARY_WD(120,8400,12,2,v_pn,100.0,CSEOF,1.0,PCTS,PCVAR) !call CYCLOSTATIONARY_WD(ntime,nstation,nestedPer,nmodes,TSER,msgOrig,CSEOF,cseofScale,PCTS,PCVAR)  

  • 1

    回答

  • 13

    浏览

Empty flash at 0x00889550 ends at 0x00889b80 Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes empty_blocks 1954, bad_blocks 6, c->nr_blocks 2029 VFS: Cannot open root device "mtdblock3" or unknown-block(31,3) Please append a correct "root=" boot option; here are the available partitions: 1f00        256 mtdblock0 (driver?) 1f01        128 mtdblock1 (driver?) 1f02       2048 mtdblock2 (driver?) 1f03     259712 mtdblock3 (driver?) Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)  

  • 1

    回答

  • 72

    浏览

D:\Go\projeck\src\github.com>go build go: go.mod file not found in current directory or any parent directory; see 'go help modules'

  • 4

    回答

  • 40

    浏览

我定义的数组内容为1,2,3 。    打印出的结果为毛会有其他数字出现?求大佬指点 #include<iostream> using namespace std; main() { int ls[]= {1,2,3}; for (int i=0; i<=sizeof(ls); i++) { cout << ls[i] << endl; } cout << endl; return 0; }  

  • 1

    回答

  • 15

    浏览

不需要下位机   系统框图类似下面这样的   最近也在学LabVIEW,就是无从下手的感觉  

  • 3

    回答

  • 18

    浏览

 假如收到扫码枪的数据是1,就打开1.bmp图像并全屏在屏幕2上显示;  假如收到扫码枪的数据是2,就打开2.bmp图像并全屏在屏幕2上显示;  假如收到扫码枪的数据是3,就打开3.bmp图像并全屏在屏幕2上显示; .......

  • 5

    回答

  • 44

    浏览

select * from (sele * from 表) order by ta_code。括号里面是一个联合查询,加了order by响应速度要9秒。不加只要1秒。请问怎么优化?

  • 2

    回答

  • 25

    浏览

 结构体定义如下图:   主函数定义了这么一个变量,     然后主函数中赋值给bit1.b2 然后再定时器中给  bit1.b0   赋值 然后判定  bit1.b0 输出PWM波   然后出现的现象为 IRQ_STATU 该等于1时,却等于0 ,该等于0时,却等于1,。然后导致输出的PWM波形如下图  不知道是我的结构体定义有问题还是怎么了。 如果不用位定义这两个变量,而是直接定位为unsigned char ,,则不会出现这个问题,不知道有谁遇见过这个情况?希望谁能指正出问题所在,一起学习学习

  • 5

    回答

  • 41

    浏览

void test(int *q) { std::shared_ptr<const int> ptr(q); std::cout << *ptr << std::endl; } int main(int argc,char *argv[]) { int *p = new int(3); test(p); delete p; return 0; } 请问这样会造成内存的重复释放吗? 个人理解:智能指针ptr在函数周期结束后会被释放掉,所以会释放ptr所指向的内存,而主函数中delete会再次释放,但是这段代码能跑通,最后输出3

回答 cp_csdn_id
采纳率100%
29天前
  • 12

    回答

  • 208

    浏览

istream& operator >>(istream &input, sales_data &s){ input >> s.bookno >> s.units_sold >> s.price; if(input){ s.revenue = s.units_sold * s.price; } return input; } ostream& operator << (ostream &output,sales_data &s){ output << s.bookno <<" "<< s.units_sold << " "<<s.revenue<<" "<<s.avg_price()<<endl; return output; } 单独使用cin和cout都没有问题,就是流迭代器使用的时候有问题 istream_iterator<sales_data> item_iter(cin),eof; ostream_iterator<sales_data> out_iter(cout," "); sales_data sum = *item_iter++; while(item_iter!=eof){ if(sum.isbn()==item_iter->isbn()){ sum += *item_iter++; } else{ out_iter = sum;//出问题地方 sum += *item_iter++; } } out_iter = sum;//出问题地方  

  • 2

    回答

  • 20

    浏览

现在已有温度数据,并用程序读取出各地温度;基准站序列变化的数据和温度如下。想请大佬帮忙写一个把两个数据对应起来的程序,最好显示图像 clc clear all; %InPath = '/Volumes/Wang Kaihua/Wang Kaihua/PhD data/LST_grid/NOAA:NCEP_0.5/tmin.2018.nc';  InPath = 'C:\Users\asus\Desktop\毕设\';  ncdisp(strcat(InPath,'tmin.2000.nc')); % %?????????????????? % filename = dir(InPath);  %name=filename.name; %ncdisp(strcat(name)); %??????????nc?????????????? %----------------------vardata = ncread(source,varname)????----------------% % vardata = ncread(source,varname) %source1 = strcat(name); source1 = strcat(InPath,'tmin.2000.nc'); varname1 = 'lon'; varname2 = 'lat'; varname3 = 'time'; varname4 = 'tmin'; LON = ncread(source1,varname1); LON = double(LON); LAT = ncread(source1,varname2); LAT = double(LAT); TIME = ncread(source1,varname3); TIME = double(TIME(:,1)); %??????????hours since 1900-01-01 00:00:0.0??????????MJD TIME(:,1) = double((TIME(:,1)-876588)/24+51544.5); LST = ncread(source1,varname4); %#ok<*SAGROW> %???????????????? LST = double(LST); %??????????????TIME(MJD),LON(degrees),LAT(degrees),LST(??????) %reshape??????? for i=1:1:length(TIME)     lst_vec_min(:,i)=reshape(LST(:,:,i)',259200,1);     % B = reshape(A,m,n)  将矩阵A的元素返回到一个m×n的矩阵B     %259200=720*360 end %InPath = '/Volumes/Wang Kaihua/Wang Kaihua/PhD data/LST_grid/NOAA:NCEP_0.5/tmax.2018.nc'; InPath = 'C:\Users\asus\Desktop\毕设\'; %  ncdisp(strcat(InPath,'tmax.2000.nc')); %?????????????????? %filename = dir(InPath); %name=filename.name;     %ncdisp(strcat(name)) %??????????nc?????????????? %----------------------vardata = ncread(source,varname)????----------------% % vardata = ncread(source,varname) %source1 = strcat(name); source1 = strcat(InPath,'tmax.2000.nc'); varname1 = 'lon'; varname2 = 'lat'; varname3 = 'time'; varname4 = 'tmax'; LON = ncread(source1,varname1); LON = double(LON); LAT = ncread(source1,varname2); LAT = double(LAT); TIME = ncread(source1,varname3); TIME = double(TIME(:,1)); %??????????hours since 1900-01-01 00:00:0.0??????????MJD TIME(:,1) = double((TIME(:,1)-876588)/24+51544.5); LST1 = ncread(source1,varname4); %#ok<*SAGROW> %???????????????? LST1 = double(LST1); %??????????????TIME(MJD),LON(degrees),LAT(degrees),LST(??????) %reshape??????? for i=1:1:length(TIME)     lst_vec_max(:,i)=reshape(LST1(:,:,i)',259200,1); end % for i=1:1:length(TIME) %     lst_vec_ave(:,:,i)= (LST(:,:,i)+LST1(:,:,i))/2; % end % save('201801.mat','lst_vec_ave');      LST_vec=(lst_vec_max+lst_vec_min)/2; % lat_mdmd = -15.215;%150行 % lon_mdmd = 0.267;%1列 %wuhan  lat_mdmd = 29.9;%行 纬度  lon_mdmd = 113.91;%列 经度 for i=1:1:length(TIME)     lst_temp= reshape(LST_vec(:,i),360,720);     T_mdmd(i) = bilinear_interpolation(lst_temp,lon_mdmd,lat_mdmd);     [row,column]=size(lst_temp); end save('201802.mat','LST_vec'); disp('finished!')  

  • 1

    回答

  • 29

    浏览

用stm32f407的板子,在编程用定时器5的通道2进行输入捕获实验时,采用中断的方式,捕获事件是在中断内完成,当捕获完成后清除中断标志,程序进入主函数。问题发生在成功捕获之后,无法退出中断进入主函数。在清中断标志语句前加一句输出会发现程序一直在输出该语句。怀疑中断标志未能成功清除,但是语句是正常的按照原子的例程粘贴的,不明白为什么中断推出不了,应该如何处理。 图片1和2是中断服务函数和主函数循环体,图3是原例程

  • 2

    回答

  • 18

    浏览

/* °æ±¾200901-D1 Ôö¼Ó³¬¹ýADÖµ10¼ì²â³É¹¦ ¶à·¢Ò»¸öCANIDÊý¾Ý Ôö¼ÓÕ¼ÓóöÇåʵÏÖ³ÌÐò */ #include "stm32f10x.h" #include "led.h" #include "dac.h" #include "adc.h" #include "timer.h" #include "can.h" #include "crc8_16.h" u8 fv,fv2,fv2_falg,i,ii,timer_value,flash_flag,a_num,b_num; u32 ADC1_ConvertedValue,ADC2_ConvertedValue,adjust1,adjust2,adjust3,adjust4,a_com,b_com; u8 JZdata[20]; u8 ZYdata[8]; u16 xl; u16 crc; CanRxMsg RxMessage1; CanTxMsg TxMessage; CanTxMsg TxMessage_1; //Ôö¼ÓÒ»¸öCANIDÓÃÓÚ¿ØÖÆÕ¼ÓóöÇå void IWDG_Configuration(void); void self_checking(void); void delay_us(u32 nTimer); void delay_ms(u32 nTimer); const uint16_t Sine12bit[50] = { 0x7FF,0x900,0x9FC,0xAF1,0xBD9,0xCB2,0xD79,0xE29,0xEC0,0xF3C,0xF9A,0xFDA,0xFFA,0xFFA,0xFDA,0xF9A ,0xF3C,0xEC0,0xE29,0xD79,0xCB2,0xBD9,0xAF1,0x9FC,0x900,0x7FF,0x6FE,0x602,0x50D,0x425,0x34C,0x285 ,0x1D5,0x13E,0x0C2,0x064,0x024,0x004,0x004,0x024,0x064,0x0C2,0x13E,0x1D5,0x285,0x34C,0x425,0x50D ,0x602,0x6FE}; //const uint16_t Sine12bit[128] = { //2148,2249,2349,2448,2546,2643,2738,2832,2924,3013,3101, // 3186,3268,3347,3423,3496,3565,3631,3693,3751,3805,3854, // 3899,3940,3976,4008,4035,4057,4074,4086,4094,4095,4094, // 4086,4074,4057,4035,4008,3976,3940,3899,3854,3805,3751, // 3693,3631,3565,3496,3423,3347,3268,3186,3101,3013,2924, // 2832,2738,2643,2546,2448,2349,2249,2148,2048,1948,1847, // 1747,1648,1550,1453,1358,1264,1172,1083,995,910,828,749, // 673,600,531,465,403,345,291,242,197,156,120,88,61,39,22, // 10,2,0,2,10,22,39,61,88,120,156,197,242,291,345,403,465,531, // 600,673,749,828,910,995,1083,1172,1264,1358,1453,1550,1648, // 1747,1847,1948,2048}; int main() { LED_Init(); //³õʼ»¯LED DAC_DMA_Configuration(); ADC1_Init(); CAN_Configuration(); TIM3_Base_Init(100); //1s=10000 10ºÁÃë²É¼¯Ò»´ÎÊý¾Ý fv=0; fv2=0; fv2_falg=0; timer_value=0; ii=0; xl=0; delay_ms(2500); //Ô­°æÑÓʱ2500 TxMessage.StdId=210; //´Ë´¦ÐÞ¸ÄcanID ¼ÆÖá°åµÄ TxMessage.ExtId=0; TxMessage.IDE=CAN_ID_STD; TxMessage.RTR=CAN_RTR_DATA;//Êý¾ÝÖ¡ TxMessage.DLC=8;//Êý¾Ý³¤¶È8B JZdata[2]=0x10; JZdata[6]=0x0c; // TxMessage_1.StdId=212; //´Ë´¦ÐÞ¸ÄcanID Õ¼ÓóöÇå°å×ÓCANID // TxMessage_1.ExtId=0; // TxMessage_1.IDE=CAN_ID_STD; // TxMessage_1.RTR=CAN_RTR_DATA;//Êý¾ÝÖ¡ // TxMessage_1.DLC=8;//Êý¾Ý³¤¶È8B a_num=0; b_num=0; self_checking(); while(1) { if(fv==1) { ADC1_ConvertedValue=0; //ADC1 ת»»Öµ ADC2_ConvertedValue=0; //ADC2 ת»»Öµ ii++; //¿´ÃŹ· timer_value++; //Ñ­»·²É¼¯10ºó£¬ for(i=0;i<50;i++) //ÀÛ¼Æ50´ÎADCת»»Öµ { ADC1_ConvertedValue+=(adc1data[i]&0x0000ffff); //u32 Êý×éµÍ16λ ADC1µÄת»»Öµ ADC2_ConvertedValue+=(adc1data[i]>>16); //u32 Êý×é¸ß16λ ADC2µÄת»»Öµ } ADC1_ConvertedValue/=50; //50´Îƽ¾ùÖµ ADC2_ConvertedValue/=50; // if((ADC1_ConvertedValue>adjust3)||(ADC1_ConvertedValue<adjust1)) { GPIOC->BRR=0x0040; //¿ªµÆ a_num=0x01; TxMessage_1.Data[2]=0x10;//¶ÔÓ¦ÏßȦ1,Õ¼Óõçѹ } else { a_num=0x00; TxMessage_1.Data[2]=0x01;//¶ÔÓ¦ÏßȦ1,³öÇåµçѹ GPIOC->BSRR=0x0040; } if((ADC2_ConvertedValue>adjust4)||(ADC2_ConvertedValue<adjust2)) { GPIOC->BRR=0x0080; b_num=0x10; TxMessage_1.Data[3]=0x10;//¶ÔÓ¦ÏßȦ2,Õ¼Óõçѹ } else { b_num=0x00; TxMessage_1.Data[3]=0x01;//¶ÔÓ¦ÏßȦ2,³öÇåµçѹ GPIOC->BSRR=0x0080; } // if((adjust3>a_com>adjust1)&&(adjust4>b_com>adjust2)) { JZdata[timer_value+9]=0x00; a_num=0x00; b_num=0x00; GPIOC->BSRR=0x00c0; //Á½¸öµÆÃð } JZdata[timer_value+9]=a_num+b_num; // if(fv2_falg==1) //ÿ¸ô1S£¬·¢ËÍÕ¼ÓóöÇåµÄÊý¾Ý // { // // TxMessage_1.Data[0]=0x11; // TxMessage_1.Data[1]=0x00; // TxMessage_1.Data[2]=TxMessage_1.Data[2]+0x00; // TxMessage_1.Data[3]=TxMessage_1.Data[3]+0x00; // TxMessage_1.Data[4]=0x00; // TxMessage_1.Data[5]=0x00; // TxMessage_1.Data[6]=0x00; // TxMessage_1.Data[7]=0x00; // CAN_Transmit(CAN1,&TxMessage_1); // fv2_falg=0; // } if(timer_value==10) { timer_value=0; xl++; JZdata[0]=xl; JZdata[1]=xl>>8; crc=Get_Crc16(JZdata,20); TxMessage.Data[0]=0x7E; TxMessage.Data[1]=JZdata[0]; TxMessage.Data[2]=JZdata[1]; TxMessage.Data[3]=JZdata[2]; TxMessage.Data[4]=JZdata[3]; TxMessage.Data[5]=JZdata[4]; TxMessage.Data[6]=JZdata[5]; TxMessage.Data[7]=JZdata[6]; CAN_Transmit(CAN1,&TxMessage); TxMessage.Data[0]=JZdata[7]; TxMessage.Data[1]=JZdata[8]; TxMessage.Data[2]=JZdata[9]; TxMessage.Data[3]=JZdata[10]; TxMessage.Data[4]=JZdata[11]; TxMessage.Data[5]=JZdata[12]; TxMessage.Data[6]=JZdata[13]; TxMessage.Data[7]=JZdata[14]; CAN_Transmit(CAN1,&TxMessage); TxMessage.Data[0]=JZdata[15]; TxMessage.Data[1]=JZdata[16]; TxMessage.Data[2]=JZdata[17]; TxMessage.Data[3]=JZdata[18]; TxMessage.Data[4]=JZdata[19]; TxMessage.Data[5]=crc; TxMessage.Data[6]=crc>>8; TxMessage.Data[7]=0x7F; CAN_Transmit(CAN1,&TxMessage); if(xl==60000){xl=0;} } if(ii==50) { IWDG_ReloadCounter(); GPIOC->BRR=0x0020; //µçÔ´¹¤×÷ָʾµÆ } if(ii==100){IWDG_ReloadCounter(); GPIOC->BSRR=0x0020; ii=0;} fv=0; } } } void USB_LP_CAN1_RX0_IRQHandler(void) { CAN_Receive(CAN1,CAN_FIFO0, &RxMessage1); // DataValue=1; // if(RxMessage1.StdId==200){flash_flag=1;} CAN_ClearITPendingBit(CAN1,CAN_IT_FMP0); } void USB_HP_CAN1_TX_IRQHandler(void) //CAN TX { if (CAN_GetITStatus(CAN1,CAN_IT_TME)!= RESET) { CAN_ClearITPendingBit(CAN1,CAN_IT_TME); } } void TIM3_IRQHandler(void) //TIM3ÖÐ¶Ï { if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) //¼ì²éÖ¸¶¨µÄTIMÖжϷ¢ÉúÓë·ñ:TIM ÖжÏÔ´ { TIM_ClearITPendingBit(TIM3, TIM_IT_Update ); //Çå³ýTIMxµÄÖжϴý´¦Àíλ:TIM ÖжÏÔ´ fv=1; if(fv2_falg==0)fv2++; if(fv2==100) { fv2_falg=1; fv2=0; } } } void self_checking(void) { u8 i; for(i=0;i<50;i++) { ADC1_ConvertedValue+=(adc1data[i]&0x0000ffff); ADC2_ConvertedValue+=(adc1data[i]>>16); } ADC1_ConvertedValue/=50; ADC2_ConvertedValue/=50; adjust1=ADC1_ConvertedValue-20; //Ô­°æÊÇ-100 adjust2=ADC2_ConvertedValue-20; //Ô­°æÊÇ-100 adjust3=ADC1_ConvertedValue+20; // adjust4=ADC2_ConvertedValue+20; // } void IWDG_Configuration(void) { IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_SetPrescaler(IWDG_Prescaler_64); IWDG_SetReload(800); IWDG_ReloadCounter(); IWDG_Enable(); } void delay_us(u32 nTimer) { u32 i=0; for(i=0;i<nTimer;i++){ __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); } } void delay_ms(u32 nTimer) { u32 i=1000*nTimer; delay_us(i); }  

  • 2

    回答

  • 26

    浏览

比如这样,我把U盘里的某个隐藏文件通过bat下copy命令复制到桌面然后取消隐藏这个文件。怎么做呢

  • 2

    回答

  • 22

    浏览

    学习FPGA有好几个月了,买的开发板基本的功能差不多都自己独立写代码上机成功验证(也可以自己做点小东西出来玩玩),想咨询一下各位大佬接下来应该怎么做才能够提高啊?表示有点迷茫,自己平时能够接触到的项目很少很少(基本上没有)。

  • 1

    回答

  • 29

    浏览

  //头文件 #ifndef WIDGET_H #define WIDGET_H #include <QWidget> #include <QStackedLayout> #include <QListWidget> #include <QHBoxLayout> #include <QObject> namespace Ui { class Widget; } class Widget : public QWidget { Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); private slots: void on_listWidget_clicked(const QModelIndex &index); private: Ui::Widget *ui; QListWidget *listWidget; QStackedLayout *sLayout; QHBoxLayout *hLayout; }; #endif //源文件 #include "widget.h" #include "ui_widget.h" #include <QLayout> #include <QLabel> Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); QListWidget *listWidget = new QListWidget(); listWidget->addItem("One"); listWidget->addItem("Two"); listWidget->addItem("Three"); QWidegt *widget1 = new QWidget(); QWidegt *widget2 = new QWidget(); QWidegt *widget3 = new QWidget(); QLabel *label1 = new QLabel("LABEL ONE", widget1); QLabel *label2 = new QLabel("LABEL TWO", widget2); QLabel *label3 = new QLabel("LABEL THREE", widget3); QStackedLayout *sLayout = new QStackedLayout(); sLayout->addWidget(widget1); sLayout->addWidget(widget2); sLayout->addWidget(widget3); QHBoxLayout *hLayout = QHBoxLayout(); hLayout->addWidget(listWidget); hLayout->addLayout(sLayout); setLayout(hLayout); QObject::connect(listWidget, &QListWidget::currentRowChanged, sLayout, &QStackedLayout::setCurrentIndex); } Widget::~Widget() { delete ui; } //错误如下 编译错误:

  • 1

    回答

  • 12

    浏览

LabView中的波形图表在鼠标进入后,能够放大控件显示,鼠标离开后自动恢复,求详细说明

  • 4

    回答

  • 31

    浏览

#include<iostream> using namespace std; void swap(char ch1,char ch2) {     char ch;     if(ch1<ch2)     {         ch=ch1;         ch1=ch2;         ch2=ch;     } } int main() {     char ch1,ch2;     cin>>ch1>>ch2;     swap(ch1,ch2);     cout<<ch1<<ch2<<endl;     return 0; }

回答 De_IT
采纳率0%
29天前
  • 3

    回答

  • 21

    浏览

之前的一个同事做了一个InstallShield 打包工程,打包后的安装包运行不用点下一步,能全自动运行安装,但是我把程序版本号改了后,再运行安装包就提示是否需要覆盖原版本,就没法自动安装了,哪位大神知道,这种情况怎么解决,在哪个地方可以配置?

  • 6

    回答

  • 40

    浏览

我们常说一个系统的最优结构是第一版开发完毕的时候,为什么系统会随着后续需求的不断叠加,而代码渐渐变得混乱?根源在哪?应该如何避免?

  • 2

    回答

  • 12

    浏览

用RStudio怎么把一个数据集里的有超过50%的缺失值的行删除?求助!

  • 4

    回答

  • 88

    浏览

CSSCI下载的题录数据如下:  每条文献数据之间有“——”分隔。   如何批量的转化成以下格式?  求赐教 谢谢!

回答 yydmn
采纳率100%
29天前
  • 3

    回答

  • 26

    浏览

有哪些是目标状态可以改变的, 怎么把这个的结果改变啊?  

  • 4

    回答

  • 48

    浏览

描述: 请计算两个整数的和并输出结果。 输入: 两个数字或者两个用空格分开的单个字符。 输出: 如输入为两个数字,请输出两数之和 否则请输出Error!

  • 2

    回答

  • 16

    浏览

这里是一个小白,按照虹软给的说明书把头文件目录什么的都配置好了,但是运行的时候出现了应用程序无法正常启动0xc000007b的bug,有人说是我vs版本不对,所以该怎么解决呢

  • 2

    回答

  • 21

    浏览

尝试运行一段Hanoi代码. 用Terminal编译器运行没问题能出结果。但是用VS CODE运行就出这个:collect2.exe: error: ld returned 1 exit status。已经sava all啦。大神们帮忙看一看!!! //Main.cpp #include "Game.h" #include <iostream> int main(){ Game g; std::cout << "Initial game state: " << std::endl; std::cout << g << std::endl; g.solve(); std::cout << "Final game state: " << std::endl; std::cout << g << std::endl; return 0; } //Stack.cpp #include "Stack.h" #include <exception> #include <iostream> using std::cout; using std::endl; void Stack::push_back(const Cube & cube) { // Ensure that we do not push a cube on top of a smaller cube: if ( size() > 0 && cube.getLength() > peekTop().getLength() ) { std::cerr << "A smaller cube cannot be placed on top of a larger cube." << std::endl; std::cerr << " Tried to add Cube(length=" << cube.getLength() << ")" << std::endl; std::cerr << " Current stack: " << *this << std::endl; throw std::runtime_error("A smaller cube cannot be placed on top of a larger cube."); } cubes_.push_back(cube); } Cube Stack::removeTop() { Cube cube = peekTop(); cubes_.pop_back(); return cube; } Cube & Stack::peekTop() { return cubes_[cubes_.size() - 1]; } unsigned Stack::size() const { return cubes_.size(); } std::ostream& operator<<(std::ostream & os, const Stack & stack) { for (unsigned i = 0; i < stack.size(); i++) { os << stack.cubes_[i].getLength() << " "; } os << endl; return os; } //Stack.h #pragma once #include <vector> #include "uiuc/Cube.h" using uiuc::Cube; class Stack { public: void push_back(const Cube & cube); Cube removeTop(); Cube & peekTop(); unsigned size() const; // An overloaded operator<<, allowing us to print the stack via `cout<<`: friend std::ostream& operator<<(std::ostream & os, const Stack & stack); private: std::vector<Cube> cubes_; }; //game.cpp #include "Game.h" #include "Stack.h" #include "uiuc/Cube.h" #include "uiuc/HSLAPixel.h" #include <iostream> using std::cout; using std::endl; // Game default constructor Game::Game() { // The initial default game state has three stacks four cubes. // Create the three empty stacks: for (int i = 0; i < 3; i++) { Stack stackOfCubes; stacks_.push_back( stackOfCubes ); } // Create the four cubes, placing each on the [0]th stack: // - A blue cube of length=4, on the bottom // - A orange cube of length=3, on top of the blue cube // - A purple cube of length=2, on top of the orange cube // - A yellow cube of length=1 at the very top Cube blue(4, uiuc::HSLAPixel::BLUE); stacks_[0].push_back(blue); Cube orange(3, uiuc::HSLAPixel::ORANGE); stacks_[0].push_back(orange); Cube purple(2, uiuc::HSLAPixel::PURPLE); stacks_[0].push_back(purple); Cube yellow(1, uiuc::HSLAPixel::YELLOW); stacks_[0].push_back(yellow); } void Game::_move(unsigned index1, unsigned index2) { Cube cube = stacks_[index1].removeTop(); stacks_[index2].push_back(cube); } void Game::_legalMove(unsigned index1, unsigned index2) { if (stacks_[index1].size() == 0 && stacks_[index2].size() > 0) { _move(index2, index1); } else if (stacks_[index1].size() > 0 && stacks_[index2].size() == 0) { _move(index1, index2); } else if (stacks_[index1].size() > 0 && stacks_[index2].size() > 0) { if (stacks_[index1].peekTop().getLength() < stacks_[index2].peekTop().getLength() ) { _move(index1, index2); } else { _move(index2, index1); } } cout << *this << endl; } void Game::solve() { while (stacks_[2].size() != 4) { _legalMove(0, 1); _legalMove(0, 2); _legalMove(1, 2); } } std::ostream& operator<<(std::ostream & os, const Game & game) { for (unsigned i = 0; i < game.stacks_.size(); i++) { os << "Stack[" << i << "]: " << game.stacks_[i]; } return os; } //game.h #pragma once #include "Stack.h" #include <vector> class Game { public: Game(); void solve(); // An overloaded operator<<, allowing us to print the stack via `cout<<`: friend std::ostream& operator<<(std::ostream & os, const Game & game); private: std::vector<Stack> stacks_; private: void _move(unsigned index1, unsigned index2); void _legalMove(unsigned index1, unsigned index2); }; //UIUC/Cube.cpp #include "Cube.h" #include "HSLAPixel.h" #include <iostream> namespace uiuc { Cube::Cube(double length, uiuc::HSLAPixel color) { length_ = length; color_ = color; } double Cube::getLength() const { return length_; } double Cube::getVolume() const { return length_ * length_ * length_; } double Cube::getSurfaceArea() const { return 6 * length_ * length_; } void Cube::setLength(double length) { length_ = length; } } //UIUC/Cube.h #pragma once #include "HSLAPixel.h" namespace uiuc { class Cube { public: // Cube(double length, HSLAPixel color); double getLength() const; void setLength(double length); double getVolume() const; double getSurfaceArea() const; private: double length_; HSLAPixel color_; }; } //UIUC/HSLAPixel.cpp #include "HSLAPixel.h" #include <cmath> #include <iostream> using namespace std; namespace uiuc { HSLAPixel HSLAPixel::BLUE = HSLAPixel(240, 1, 0.5); HSLAPixel HSLAPixel::ORANGE = HSLAPixel(30, 1, 0.5); HSLAPixel HSLAPixel::YELLOW = HSLAPixel(60, 1, 0.5); HSLAPixel HSLAPixel::PURPLE = HSLAPixel(270, 1, 0.5); HSLAPixel::HSLAPixel() { h = 0; s = 0; l = 1.0; a = 1.0; } HSLAPixel::HSLAPixel(double hue, double saturation, double luminance) { h = hue; s = saturation; l = luminance; a = 1.0; } HSLAPixel::HSLAPixel(double hue, double saturation, double luminance, double alpha) { h = hue; s = saturation; l = luminance; a = alpha; } } //UIUC/HSLAPixel.h #pragma once #include <iostream> #include <sstream> namespace uiuc { class HSLAPixel { public: //static uiuc::HSLAPixel ILLINI_ORANGE; //static uiuc::HSLAPixel ILLINI_BLUE; double h; /**< Hue of the pixel, in degrees [0, 360). */ double s; /**< Saturation of the pixel, [0, 1]. */ double l; /**< Luminance of the pixel, [0, 1]. */ double a; /**< Alpha of the pixel, [0, 1]. */ /** * Constructs a default HSLAPixel. * * A default pixel is completely opaque (non-transparent) and white. * Opaque implies that the alpha component of the pixel is 1.0. * Lower alpha values are (semi-)transparent. */ HSLAPixel(); /** * Constructs an opaque HSLAPixel with the given hue, saturation, * and luminance values. * * @param hue Hue value for the new pixel, in degrees [0, 360). * @param saturation Saturation value for the new pixel, [0, 1]. * @param luminance Luminance value for the new pixel, [0, 1]. */ HSLAPixel(double hue, double saturation, double luminance); /** * Constructs an HSLAPixel with the given hue, saturation, * luminance, and alpha values. * * @param hue Hue value for the new pixel, in degrees [0, 360). * @param saturation Saturation value for the new pixel, [0, 1]. * @param luminance Luminance value for the new pixel, [0, 1]. * @param alpha Alpha value for the new pixel, [0, 1]. */ HSLAPixel(double hue, double saturation, double luminance, double alpha); static HSLAPixel BLUE; static HSLAPixel ORANGE; static HSLAPixel YELLOW; static HSLAPixel PURPLE; }; }  

回答 UIUCZIZI
采纳率0%
28天前
  • 2

    回答

  • 20

    浏览

Mat img = imread(filename.toStdString()); imshow("src", img); Mat grad_x, grad_y; Mat abs_grad_x, abs_grad_y, dst; //求x方向梯度 Sobel(img, grad_x, CV_16S, 1, 0, 3, 1, 1, BORDER_DEFAULT); convertScaleAbs(grad_x, abs_grad_x); imshow("x-soble", abs_grad_x); //求y方向梯度 Sobel(img, grad_y, CV_16S, 0, 1, 3, 1, 1, BORDER_DEFAULT); convertScaleAbs(grad_y, abs_grad_y); imshow("y-soble", abs_grad_y); //合并梯度 //cv::add(abs_grad_x,abs_grad_y,dst); addWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, dst); imshow("Sobel", dst); return; 代码如上,参数传递没什么错误啊,运行到addweighted就报段错误,实在是找不到原因。 我后来用了最简单的cv::add(abs_grad_x,abs_grad_y,dst);也不行,也是报错

  • 2

    回答

  • 25

    浏览

class test1{ public: test1(){ cout << "default" << endl; } test1(const test1 &test) =delete; test1& operator=(const test1 &test) = delete; }; int main() { test1 test[3] = {test1(), test1(), test1()}; return 0; } 报错:error: use of deleted function 'test1::test1(const test1&)'|   但test数组应该没有调用拷贝构造呀,证明如下 class test1{ public: test1(){ cout << "default" << endl; } test1(const test1 &test){ cout << "copy" << endl; } test1& operator=(const test1 &test){ cout << "operator =" << endl; return *this; } }; int main() { test1 test[3] = {test1(), test1(), test1()}; return 0; } 的输出为: default default default Process returned 0 (0x0) execution time : 0.423 s Press any key to continue. ------------------------------------------------------------------------------------------------------ 刚刚又试了下  发现 不是数组初始化的问题,     只要是类似  test1 test = test1();这种用显示调用构造函数的都报上诉错wu