echart polar中的axisLabel属性无效

echart polar中的axisLabel属性无效,绘图类型radar,要自定义axisLabel,添加点击事件,请问有什么方法?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
提示:TypeError: title() missing 1 required positional argument: 'label',求解。
import numpy as np import matplotlib.pyplot as plt plt.subplot(111,polar = True) dataLenth = 5 angles = np.linspace(0,2*np.pi,dataLenth,endpoint=False) labels =['沟通能力','业务理解能力','逻辑思维能力','快速学习能力','工具使用能力'] data = [2,3.5,4,4.5,5] data = np.concatenate((data, [data[0]])) angles = np.concatenate((angles, [angles[0]])) plt.polar(angles,data,color = "r",marker = "o") plt.xticks(angles,labels) plt.title(t = "某数据分析师的综合评级") plt.savefig("D:/pyx/polarplot.jpg") 上面是相关代码,运行后提示错误:TypeError: title() missing 1 required positional argument: 'label',求解。
Shortest Path on a Cylinder 是怎么编写的呢
Problem Description Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another. Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer. Input There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder. For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0) - (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h). You may assume that r!=radius only when h=0 or h=height for each point. Warning: There are about one thousand test cases. Be careful with the time efficiency. Output For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point. Sample Input 2 5 10 10 0 3 5 0 5 90 49 49 312 39 0 52 65 Sample Output Case #1: 7.00 Case #2: 171.02
Defense of the Ancients
Problem Description DotA? I’m afraid you’ve got a wrong impression, because we are talking about some real Ancients. A lot of towers are in the first quadrant of rectangular coordinates. And between every two towers there is a wall. All of them are Ancients. Somehow, some skytroopers are trying to attack our Ancients and all we know is that they’ll land at the second, third and fourth quadrant of rectangular coordinates. Because those areas are desolation, the troops decided to follow a fixed straight line. Now we’ve got all the landing coordinates of the troops and the polar angle of their walking lines. To protect our Ancients, we need to know where the troops will first arrive at the Ancients. Input There are multiple test cases. First line contains a single integer T (T<=10), indicates the number of test cases. For each test case: The first line has two positive integers N and M (1<N<=100000, M<=100000), represent the number of towers and skytroopers. Following N lines, each line contains two integers X and Y, represents the coordinate of the tower. Following M lines, each line has three integers SX, SY and XITA, indicates the coordinates of a skytrooper and the polar angle of their attacking line (in degrees). SX and SY will not bigger than 0 at the same time. All the coordinates values lies in [-20000, 20000]. No two towers will be in same place. Output For every skytrooper, output one line, if the trooper can reach the Ancients, output the coordinate he will first arrive, otherwise output “safe”. If the value differs in 0.01 with our standard output, we’ll consider it as accepted. Sample Input 1 6 3 5 1 8 5 13 2 14 7 7 9 1 7 -2 -2 45 8 -2 90 -3 7 120 Sample Output 3.400000 3.400000 8.000000 1.375000 safe
Shortest Path on a Cylinder 最短路径
Problem Description Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another. Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer. Input There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder. For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0) - (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h). You may assume that r!=radius only when h=0 or h=height for each point. Warning: There are about one thousand test cases. Be careful with the time efficiency. Output For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point. Sample Input 2 5 10 10 0 3 5 0 5 90 49 49 312 39 0 52 65 Sample Output Case #1: 7.00 Case #2: 171.02
Shortest Path on a Cylinder 圆柱的问题
Problem Description Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another. Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer. Input There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder. For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0) - (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h). You may assume that r!=radius only when h=0 or h=height for each point. Warning: There are about one thousand test cases. Be careful with the time efficiency. Output For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point. Sample Input 2 5 10 10 0 3 5 0 5 90 49 49 312 39 0 52 65 Sample Output Case #1: 7.00 Case #2: 171.02
编写的polar码译码程序为什么运行速度这么慢呢?怎么解决呢
以下是C程序,只是译码程序,y是接收的加噪声的信息序列,p是位置矩阵,sigma是标准差,uyima是译码后序列,为什么运行速度这么慢呢
代码实现,Shortest Path on a Cylinder
Problem Description Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another. Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer. Input There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder. For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0) - (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h). You may assume that r!=radius only when h=0 or h=height for each point. Warning: There are about one thousand test cases. Be careful with the time efficiency. Output For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point. Sample Input 2 5 10 10 0 3 5 0 5 90 49 49 312 39 0 52 65 Sample Output Case #1: 7.00 Case #2: 171.02
结构 指针 指向性问题
#include<iostream> #include<cmath> // 声明2个结构:polar 和 rect struct polar { double distance; double angle; }; struct rect { double x; double y; }; // 声明 2个指针变量:polar类型rect_to_polar,数组:rect类型的xypos polar rect_to_polar(rect xypos); // polar类型 rect_to_polar和rect类型 xypos void show_polar(polar dapos); // polar类型 dapos int main() { using namespace std; rect rplace; // 创建rect类型的变量rplace polar pplace; cout << "Enter the x and y value: "; while (cin>>rplace.x>>rplace.y) // rplace.x我不太明白如何存储的,rplace的变量名+句点成员x,是不是存储在了结构里了?创建一个变量本身是不产生空间的,创建一个结构才会有空间? { pplace = rect_to_polar(rplace);// 将对象rect_to_polar(指针)赋给pplace变量? show_polar(pplace);// 将变量pplace赋给变量show_polar? cout << "Next two numbers (q to quit): "; } cout << "Done.\n "; return 0; } // 定义polar rect_to_polar(rect xypos) polar rect_to_polar(rect xypos) { using namespace std; polar answer; // 创建polar类型 的 answer answer.distance = sqrt(xypos.x*xypos.x + xypos.y*xypos.y);//xypos.x相当于变量xypos与结构变量x的值,然后赋给了局部变量answer的结构变量distance? answer.angle = atan2(xypos.y, xypos.x); return answer; } // 定义void show_polar(polar dapos) void show_polar(polar dapos) { using namespace std; const double Rad_to_deg = 57.29577951; cout << "distance = " << dapos.distance; cout << ", angle = " << dapos.angle*Rad_to_deg; cout << "degrees \n "; } ######################## 如果改用指针来指向结构变量又有问题了 #include<iostream> #include<cmath> struct polar { double distance; double angle; }; struct rect { double x; double y; }; void rect_to_polar(const rect*pxy, polar*pda); // 这里为什么设置2个指针*pxy*pda void show_polar(const polar*pda);// 这里又设置了一模一样的*pda,会不会有问题? int main() { using namespace std; rect rplace; polar pplace; cout << "Enter the x and y values: "; while (cin >> rplace.x >> rplace.y) { rect_to_polar(&rplace, &pplace); // 这里套了2层,将&pplace的地址传导rplace变量,再将&rplace地址传到了rect_to_polar? show_polar(&pplace); //这里不明白怎么又是&pplace地址了呢 cout << "Next two numbers (q to quit) : "; } cout << "Done.\n"; system("pause"); return 0; } void show_polar(const polar*pda) { using namespace std; const double Rad_to_deg = 57.29577951; cout << "distance=" << pda->distance; cout << ", angle =" << pda->angle*Rad_to_deg; cout << "degrees\n "; } void rect_to_polar(const rect*pxy, polar*pda) { using namespace std; pda->distance = sqrt(pxy->x*pxy->x + pxy->y*pxy->y); pda->angle = atan2(pxy->y, pxy->x); } 上面2题是教程里面的题目,麻烦大神们给我思路理一下,不胜感激啊!
求问这个代码如何解决错误使用 mesh (line 75) Z 必须为矩阵,不能是标量或矢量。?
这个代码本来是只有二维图,想用mesh生成一个三维图,请问该如何修改? 加了mesh总是报错 错误使用 mesh (line 75) Z 必须为矩阵,不能是标量或矢量。 ``` clc; clear; f = 750;%单频信号的频率 fsample = 50*f;%采样频率 dlts = 1/fsample;%采样周期 dd = 1;%阵元间距 cc=1500;%声速 dsita=2/360*pi;%扫描角度间隔 beam_no=2*pi/dsita;%波束个数 m=8;%阵元个数 dltc=cc*dlts;%一个采样周期声波传播的距离 t = 0.005:dlts:0.056; n = length(t); bn=round(dd/dltc); ks=n-floor(m/2)*2*bn-1; ss=zeros(beam_no,ks); theta =45; %单频信号 xx(1,:) = cos (2*pi*f.*t); xx(2,:) = cos(2*pi*f.*(t - 3*dd*cos(theta*pi/180)/cc)); xx(3,:) = cos(2*pi*f.*(t + 3*dd*sin(theta*pi/180)/cc)); xx(4,:) = cos(2*pi*f.*(t + 3*dd*cos(theta*pi/180)/cc)); xx(5,:) = cos(2*pi*f.*(t - 3*dd*sin(theta*pi/180)/cc)); xx(6,:) = cos(2*pi*f.*(t - dd*cos(theta*pi/180)/cc)); xx(7,:) = cos(2*pi*f.*(t - 2*dd*cos(theta*pi/180)/cc)); xx(8,:) = cos(2*pi*f.*(t + dd*sin(theta*pi/180)/cc)); xx(9,:) = cos(2*pi*f.*(t + 2*dd*sin(theta*pi/180)/cc)); xx(10,:) = cos(2*pi*f.*(t + dd*cos(theta*pi/180)/cc)); xx(11,:) = cos(2*pi*f.*(t + 2*dd*cos(theta*pi/180)/cc)); xx(12,:) = cos(2*pi*f.*(t - dd*sin(theta*pi/180)/cc)); xx(13,:) = cos(2*pi*f.*(t - 2*dd*sin(theta*pi/180)/cc)); for i=1:beam_no dltn(1)=0; dltn(2)=round(3*dd*cos(dsita*(i-1))/dltc); dltn(3)=round(-3*dd*sin(dsita*(i-1))/dltc); dltn(4)=round(-3*dd*cos(dsita*(i-1))/dltc); dltn(5)=round(3*dd*sin(dsita*(i-1))/dltc); dltn(6)=round(dd*cos(dsita*(i-1))/dltc); dltn(7)=round(2*dd*cos(dsita*(i-1))/dltc); dltn(8)=round(-dd*sin(dsita*(i-1))/dltc); dltn(9)=round(-2*dd*sin(dsita*(i-1))/dltc); dltn(10)=round(-dd*cos(dsita*(i-1))/dltc); dltn(11)=round(-2*dd*cos(dsita*(i-1))/dltc); dltn(12)=round(dd*sin(dsita*(i-1))/dltc); dltn(13)=round(2*dd*sin(dsita*(i-1))/dltc); for j=1:13 ss(i,:)=ss(i,:)+xx(j,bn*floor(m/2)+1+dltn(j)+1:n-bn*floor(m/2)-1+dltn(j)+1); end end peakx=zeros(1,beam_no); for i=1:beam_no peakx(i)=var(ss(i,:)); end alpha = 0:1/180*pi:2*pi-1/180*pi; polar(alpha,peakx); figure,mesh(abs(peakx)) ```
echarts图表报错,触发事件重新加载图表时报错
var kpiDataList; var supplier; var index; var analysisQuery = function(){ return { fillCharInfo:function(xData,seriesData){ var IndexDataChart = echarts.init(document.getElementById('IndexDataChart')); var option = { tooltip : { trigger: 'axis' }, calculable : true, xAxis : [ { type : 'category', boundaryGap : false, data : xData } ], yAxis : [ { type : 'value', axisLabel : { formatter: '{value}' } } ], grid: { width: 300, height: 150, y: 30, x: 30, borderColor: '#fff' }, series : [ { name:'指标结果值', type:'line', data:seriesData, markPoint : { data : [ {type : 'max', name: '最大值'}, {type : 'min', name: '最小值'} ] }, markLine : { data : [ {type : 'average', name: '平均值'} ] } } ] }; IndexDataChart.setOption(option); }, /** * 查询考核记录排名 */ querySupplierScore : function(){ var timeRange = $("#timeRange").val(); var params = []; params.push({name : 'timeRange', value : timeRange}); $.ajax({ type : "POST", url : "srm/owner/facade/assessment/getSupplierRank.shtml", data : params, dataType : "json", async:false, success : function(data) { if (data[0].length > 0) { var dataList = data[0]; drawRankChart(dataList); analysisQuery.querySupplierIndex(dataList[0].companyName); } } }); }, /** * 查询供应商的指标信息分析 */ querySupplierIndex : function(supplierName){ var timeRange = $("#timeRange").val(); var params = []; params.push({name : 'timeRange', value : timeRange}); params.push({name : 'supplierName', value : supplierName }); $.ajax({ type : "POST", url : "srm/owner/facade/assessment/getSupplierIndex.shtml", data : params, dataType : "json", async:false, success : function(data) { if (null != data) { $('#IndexAnalysisChart').empty(); var indexNameList = data[0]; var indexMaxValueList = data[1]; var indexValueList = data[2]; kpiDataList = data[3]; drawPieChart(indexNameList,indexMaxValueList,indexValueList); if(indexNameList.length > 0){ drawLineChart(indexNameList[0]); } } } }); }, /** * 查询供应商的考核明细 */ querySupplierKpiDetail : function(supplierName,indexName){ var timeRange = $("#detailTimeRange").val(); var params = []; params.push({name : 'timeRange', value : timeRange}); params.push({name : 'supplierName', value : supplierName }); params.push({name : 'indexName', value : indexName }); $.ajax({ type : "POST", url : "srm/owner/facade/assessment/getSupplierKpiDetail.shtml", data : params, dataType : "json", async:false, success : function(data) { if (null != data) { var list = juicer(tplKpiDetail,data); var totalCount = 0; var totalExceCount = 0; var indexValue = 0; var totalAward = 0; var totalCost = 0; var totalMoney = 0; $("#kpiDetail","#addModal").empty().append(list); var kpiDetailList = data.kpiDetailList; for(var i = 0; i<kpiDetailList.length ;i++){ totalCount += parseInt(kpiDetailList[i].lskdTotalCount); totalExceCount += parseInt(kpiDetailList[i].lskdExceptionCount); indexValue += parseInt(kpiDetailList[i].lskdOldValue); totalAward += parseInt(kpiDetailList[i].lskdAwardMoney); totalCost += parseInt(kpiDetailList[i].lskdAmerceMoney); } totalMoney = totalAward-totalMoney; indexValue = indexValue/(kpiDetailList.length); } } }); } }; }(); require.config({ paths: { echarts: 'srm/manage/js/echarts/dist' } }); function drawRankChart(data){ require( [ 'echarts', 'echarts/chart/bar' // 使用柱状图就加载bar模块,按需加载 ], function(){ // 基于准备好的dom,初始化echarts图表 var seriesData = []; var xData = []; if ('' === data || null === data){ seriesData = [0]; xData = [""]; }else{ if(data.length < 10){ for (var i = 0;i < data.length ; i++){ var supplier = data[i].companyName; var score = data[i].score; seriesData.push(score); xData.push(supplier); } }else{ for (var i = 0;i < 10 ; i++){ var supplier = data[i].companyName; var score = data[i].score; seriesData.push(score); xData.push(supplier); } } } var rankChart = echarts.init(document.getElementById('rankChart')); var ecConfig = echarts.config; rankChart.on(ecConfig.EVENT.CLICK, clickBarChart); rankChart.on(ecConfig.EVENT.DBLCLICK, showKpiDetail); var colorList = [ '#ff7d93', '#52cdd5', '#7ecef4', '#979ec9' ]; var itemStyle = { normal : { color : function(params) { if (params.dataIndex >= 0 && params.dataIndex < 3) { // for legend return colorList[params.dataIndex]; } else { return colorList[colorList.length - 1]; } } } }; var option = { tooltip : { trigger: 'axis', axisPointer : { // 坐标轴指示器,坐标轴触发有效 type : 'shadow' // 默认为直线,可选为:'line' | 'shadow' }, formatter : '{b}<br/>{a0}:{c0}' }, calculable : false, xAxis : [ { type : 'category', splitLine: {show: false}, axisLabel: { textStyle : { align : 'center' }}, data : xData } ], yAxis : [ { type : 'value', splitLine: {show: false}, axisLabel: {show: false}, axisLine: {show:false} } ], grid: { width: 700, height: 170, y: 5, x: 5, borderColor: '#fff' }, series : [ { name:'分数', clickable : true, type:'bar', stack: '总量', barWidth:40, itemStyle: itemStyle, data:seriesData } ] }; // 为echarts对象加载数据 rankChart.setOption(option); } ); } function drawPieChart(indexName,indexMaxValue,indexValue){ require( [ 'echarts', 'echarts/chart/pie' ], function() { var indicatorData = []; for(var i =0 ; i < indexName.length ; i ++){ indicatorData.push({text: indexName[i],max: indexMaxValue[i]}); } var IndexAnalysisChart = echarts.init(document.getElementById('IndexAnalysisChart')); var ecConfig = echarts.config; IndexAnalysisChart.on(ecConfig.EVENT.CLICK, clickPieChart); IndexAnalysisChart.on(ecConfig.EVENT.DBLCLICK, showKpiIndexDetail); var option = { tooltip : { trigger: 'axis' }, polar : [ { indicator : indicatorData } ], grid: { width: 300, height: 190, y: 10, x: 0, borderColor: '#fff' }, series : [ { "symbol":"emptyCircle",//空心节点, type: 'radar', data : [ { value : indexValue, name : '指标得分' } ] } ] }; // 为echarts对象加载数据 IndexAnalysisChart.setOption(option); } ); } function clickBarChart(param) { if (typeof param.seriesIndex === 'undefined') { return; } supplier = param.name; if (param.type === 'click') { analysisQuery.querySupplierIndex(param.name); } } function clickPieChart(param) { if (typeof param.seriesIndex === 'undefined') { return; } if (param.type === 'click') { index = param.name; var seriesData = []; var xData = []; if ('' === kpiDataList || null === kpiDataList){ seriesData = [0]; xData = [""]; return analysisQuery.fillCharInfo(xData,seriesData); } for (var i = 0; i < kpiDataList.length; i++) { if (kpiDataList[i].lskdLepiName === index) { var time = analysisQuery .MonthDayFormatHandler(kpiDataList[i].createTime); var score = kpiDataList[i].lskdOldValue; seriesData.push(score); xData.push(time); } } analysisQuery.fillCharInfo(xData,seriesData); } } 触发事件重新加载图表时报错: “_axisList”的值: 对象为 null 或未定义
Xpath定位xml返回值错误
xml是这样的:(为什么标签写不出来) <?xml version="1.0" encoding="utf-8"?> <doc> <text>凯美瑞现在的价格优势蛮明显的。</text> <evl id="0"> <evlobject firclass="性价比" secclass="" isimplicit="0" pos="6">价格优势</evlobject> <evlcontent polar="A" pos="10">蛮明显</evlcontent> <evlattribute pos="-1"/> <evlnegative pos="-1" neg="0"/> <evlmanuf pos="-1">丰田</evlmanuf> <evlbrand pos="-1">凯美瑞</evlbrand> <evltype pos="-1"/> <evlvsmanuf pos="-1"/> <evlvsbrand pos="-1"/> <evlvstype pos="-1"/> <evlcondition pos="-1"/> </evl> </doc> Xpath语句是这样的:/doc/evl/evlobject 我要查出来的就是“价格优势”这个词,可是返回值有时候查的到有时候查不到,我就纳闷了。 开发源语言是c#。代码是这样的: XmlDocument doc_ = new XmlDocument(); doc_.LoadXml(node.InnerXml); //ele_s:sentence的xml对象 XmlElement ele_s = null; ele_s = doc_.DocumentElement; XmlNodeList sentence = null; XmlNodeList obj = null; sentence = ele_s.SelectNodes("/doc/text"); //读取每条评论本身 obj = ele_s.SelectNodes("/doc/evl/evlobject"); //读取每条评论的评论对象 sentence是每次都能读出来但是obj就老是出错。求大神帮助啊
谁能帮我看看 这个代码问题出在哪?( linux c++ makefile)复数四则运算
## **methode.h** /* Klassendefinition*/ using namespace std; class COMPLEX { public: COMPLEX(void){}; COMPLEX(float,float,int); void ein(); void aus(int); friend float RE(COMPLEX); friend float IM(COMPLEX); friend float ABS(COMPLEX); friend float ANGLE(COMPLEX); friend COMPLEX operator+(COMPLEX, COMPLEX); friend COMPLEX operator-(COMPLEX, COMPLEX); friend COMPLEX operator*(COMPLEX, COMPLEX); friend COMPLEX operator/(COMPLEX, COMPLEX); private: float Re, Im, Abs, Angle;//Datenelemente void Umrechnung (float,float,int); }; void Ausgabe(COMPLEX Z1, COMPLEX Z2); ## ****methode.cpp #include "methode.h" #include <iostream> #include <iomanip> #include <cstdlib> #include <cmath> using namespace std; COMPLEX::COMPLEX(float a, float b, int c) { if(c==0) {Re=a; Im=b; Umrechnung(a,b,0);//(Re, Im)-> (Abs, Angle) } else if(c==1) {Abs=a; Angle=b; Umrechnung(a,b,1);//(Abs,Angle)-> (Re, Im) } } float RE(COMPLEX a){return a.Re;} float IM(COMPLEX a){return a.Im;} float ABS(COMPLEX a){return a.Abs;} float ANGLE(COMPLEX a){return a.Angle;} COMPLEX operator+ (COMPLEX Z1, COMPLEX Z2) {return COMPLEX(Z1.Re+Z2.Re,Z1.Im+Z2.Im,0);} COMPLEX operator- (COMPLEX Z1, COMPLEX Z2) {return COMPLEX(Z1.Re-Z2.Re,Z1.Im-Z2.Im,0);} COMPLEX operator* (COMPLEX Z1, COMPLEX Z2) {return COMPLEX(Z1.Re*Z2.Re-Z1.Im*Z2.Im, Z1.Re*Z2.Im+Z1.Im*Z2.Re,0);} COMPLEX operator/ (COMPLEX Z1, COMPLEX Z2) { float l; COMPLEX Z3; l= Z2.Re*Z2.Re+Z2.Im*Z2.Im; if(l==0.0) { cout<<"\nDivision durch Null!"; Z3.Re=Z3.Im=0.0; } else { Z3.Re=(Z1.Re*Z2.Re+Z1.Im*Z2.Im)/l; Z3.Im=(Z2.Re*Z1.Im-Z1.Re*Z2.Im)/l; } Z3.Umrechnung(Z3.Re, Z3.Im, 0); return Z3; } void COMPLEX::ein() { char menu; do {cout<<"\n[k]artesisch oder [P]olar?->"; cin>>menu; if(menu=='p'||menu=='P') { cout<<"\nBetrag ->"; cin>>Abs; cout<<"\nWinkel in Grad ->"; cin>>Angle; Umrechnung(Abs,Angle,1); } else if(menu=='k'||menu=='K') {cout<<"\nRealteil ->"; cin>>Re; cout<<"\nImaginaerteil ->"; cin>>Im; Umrechnung(Re,Im,0); } else cout<<"Falsche Eingabe!"; } while(menu!='p'&&menu!='k'); } //Umwandlung einer komplexer Zahl void COMPLEX::Umrechnung(float a, float b, int c) { if(c==1)//polar-->kartesisch { Re=a*cos(b/180.*M_PI); Im=a*sin(b/180.*M_PI); } else if(c==0)//kartesisch-->polar { Abs=sqrt(a*a+b*b); if(Re==0) Angle=90; else Angle=atan(b/a)*(180./M_PI); } else cout<<"Falscher Umrechen-Parameter!!\n"; } //Ausgabe void COMPLEX::aus(int i) { if(i==0) cout<<Re<<"+"<<Im<<"j"; else if(i==1) cout<<Abs<<"*Exp^("<<(Angle*M_PI/180.)<<")j"; else if(i==2) cout<<Abs<<"*[cos("<<Angle<<")+jsin("<<Angle<<")]"; else cout<<"Undefinierter Ausgabe-Parameter!!!"; } void Ausgabe(COMPLEX Z1,COMPLEX Z2) { COMPLEX Z3; cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint) <<setprecision(2)<<endl; cout<<setw(6)<<"Z1"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z1.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z1.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z1.aus(2);cout<<endl<<endl; cout<<setw(6)<<"Z2"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z2.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z2.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z2.aus(2);cout<<endl<<endl; Z3=Z1+Z2; cout<<setw(6)<<"Z1+Z2"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z3.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z3.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z3.aus(2);cout<<endl<<endl; Z3=Z1-Z2; cout<<setw(5)<<"Z1-Z2"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z3.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z3.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z3.aus(2);cout<<endl<<endl; Z3=Z1*Z2; cout<<setw(5)<<"Z1*Z2"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z3.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z3.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z3.aus(2);cout<<endl<<endl; Z3=Z1/Z2; cout<<setw(5)<<"Z1/Z2"<<setw(3)<<":"<<endl; cout<<"Kartesisch"<<setw(7); Z3.aus(0);cout<<endl; cout<<"Polar exponentiell"<<setw(7); Z3.aus(1);cout<<endl; cout<<"Polar trigonometrisch"<<setw(7); Z3.aus(2);cout<<endl; } ## **pruefung.cpp** #include "methode.h" #include <iostream> #include <cstdlib> using namespace std; int main(void) { COMPLEX Z1,Z2,Z3; char janein; do{ cout<<"\n1.Wert Z1\n"; cout<<"======="; Z1.ein(); cout<<"\n2.Wert Z2\n"; cout<<"======="; Z2.ein(); system("cls"); Ausgabe(Z1,Z2); cout<<"\nNochmal?[j/n]>"; cin>>janein; } while(toupper(janein)=='J'); return 0; } ## **makefile** pruefung:pruefung.o methode.o g++ -o pruefung pruefung.o methode.o pruefung.o:pruefung.cpp methode.h g++ -o pruefung pruefung.cpp methode.o:methode.cpp methode.h g++ -o methode methode.cpp clean: rm *.o pruefung
求大神帮我看看C++代码
以下是我的.h头文件: ``` #include <vector> #include<iostream> #include <iomanip> #include <math.h> #define M_PI 3.14159265359 ////////**************定义目标状态***************//////// typedef struct strTargetState//笛卡尔坐标系位置 { double dTargetPostionX;//x double dTargetPostionY;//y double dTargetPostionZ;//z }strTargetState; vector <strTargetState> vTargetState; //////////*************定义传感器位置*************/////// typedef struct strSensorLocate//笛卡尔坐标系位置 { double dSensorX;//x double dSensorY;//y double dSensorZ;//z }strSensorLocate; strSensorLocate strSensor1; strSensorLocate strSensor2; strSensorLocate strSensor3; strSensorLocate strSensor4; //////////*************计算极坐标下位置*************////// typedef struct strTargetPolarCoordinate//极坐标下位置 { double dTargetPitch;//俯仰角 phi double dTargetAzimuth;//方位角 thita double dTargetR;//径向距离 r }strTargetPolarCoordinate; strTargetPolarCoordinate strTargetPolar; class CHuoPaoSheng721//class declaration { public: CHuoPaoSheng721(double dIvestiRg,double dFrequency,double dDetectAccur,double dMornitScope,double dDataUpdateRate, int nMaxTargetNum,bool bDamageSatus,bool bOnOffControl,double dOriginLongitude,double dOriginLatitude,double dOriginHeight, double dL,double dh,double dSoundVelocity): m_dIvestiRg(dIvestiRg), m_dFrequency(dFrequency), m_dDetectAccur(dDetectAccur), m_dMornitScope(dMornitScope), m_dDataUpdateRate(dDataUpdateRate), m_nMaxTargetNum(nMaxTargetNum), m_bDamageSatus(bDamageSatus), m_bOnOffControl(bOnOffControl), m_dOriginLongitude(dOriginLongitude), m_dOriginLatitude(dOriginLatitude), m_dOriginHeight(dOriginHeight), m_dL(dL),//传感器坐标 m_dh(dh), m_dSoundVelocity(dSoundVelocity)//声速 { }//endof CHuoPaoSheng721 构造函数初始化 ~CHuoPaoSheng721(){}//析构函数 int get_initia_Para();//系统参数初始化显示 int sys_state();//系统工作状态判断 int get_polar();//目标角度量测 private: double m_dIvestiRg;//侦查距离 double m_dFrequency;//传声器范围 double m_dDetectAccur;//侦查精度 double m_dMornitScope;//监视范围 double m_dDataUpdateRate;//数据更新率 int m_nMaxTargetNum;//最大检测目标数 bool m_bDamageSatus;//毁伤状态 1on 0off bool m_bOnOffControl;//开关机控制 1on 0off double m_dOriginLongitude;//坐标原点经度 double m_dOriginLatitude;//坐标原点纬度 double m_dOriginHeight;//坐标原点高度 double m_dL;//传感器坐标 double m_dh; double m_dSoundVelocity;//声速 double m_dr1;//距离 double m_dr2; double m_dr3; double m_dr4; double m_dtime1;//到达时间 double m_dtime2; double m_dtime3; double m_dtime4; };//end of class CHuoPaoSheng721 以下是头文件对应的.cpp文件: #include"stdafx.h" #include <vector> #include<iostream> #include <iomanip> #include <math.h> #include "CHuoPaoSheng721.h" #define M_PI 3.14159265359 using namespace std; int CHuoPaoSheng721::get_initia_Para()//系统参数初始化显示 { cout<<"侦查距离/(km):"<<setw(8)<<m_dIvestiRg<<endl; cout<<"传声器频率范围/Hz:"<<setw(8)<<m_dFrequency<<endl; cout<<"侦查精度(m):"<<setw(8)<<m_dDetectAccur<<endl; cout<<"监视范围:"<<setw(8)<<m_dMornitScope<<endl; cout<<"数据更新率:"<<setw(8)<<m_dDataUpdateRate<<endl; cout<<"最大检测目标数:"<<setw(8)<<m_nMaxTargetNum<<endl; return 0; }//end of get_initia_Para int CHuoPaoSheng721::sys_state()//系统工作状态判断 { if ((m_bDamageSatus==1) && (m_bOnOffControl==1)) { cout<<"系统正常可进行有效侦查"<<endl; } else { if (m_bDamageSatus==0) { cout<<"系统毁伤"<<endl; } if (m_bOnOffControl==0) { cout<<"系统未开机"<<endl; } }//end of if return 0; }//end of CParaInitia int CHuoPaoSheng721::get_polar() { //////////*************定义传感器位置*************///////// strSensor1.dSensorX=m_dL; strSensor1.dSensorY=0; strSensor1.dSensorZ=m_dh; strSensor2.dSensorX=-m_dL; strSensor2.dSensorY=0; strSensor2.dSensorZ=m_dh; strSensor3.dSensorX=0; strSensor3.dSensorY=-m_dL; strSensor3.dSensorZ=m_dh; strSensor4.dSensorX=0; strSensor4.dSensorY=m_dL; strSensor4.dSensorZ=0; // m_vTargetState.push_back(m_vTargetState);目标状态获得 压入数值 ///////////**********火炮声计算************//////////// for (int i=0;i<vTargetState.size();i++) { m_dr1=sqrt(pow(strSensor1.dSensorX-vTargetState[i].dTargetPostionX,2)+pow(strSensor1.dSensorY-vTargetState[i].dTargetPostionY,2)+pow(strSensor1.dSensorZ-vTargetState[i].dTargetPostionZ,2)); m_dr2=sqrt(pow(strSensor2.dSensorX-vTargetState[i].dTargetPostionX,2)+pow(strSensor2.dSensorY-vTargetState[i].dTargetPostionY,2)+pow(strSensor2.dSensorZ-vTargetState[i].dTargetPostionZ,2)); m_dr3=sqrt(pow(strSensor3.dSensorX-vTargetState[i].dTargetPostionX,2)+pow(strSensor3.dSensorY-vTargetState[i].dTargetPostionY,2)+pow(strSensor3.dSensorZ-vTargetState[i].dTargetPostionZ,2)); m_dr4=sqrt(pow(strSensor4.dSensorX-vTargetState[i].dTargetPostionX,2)+pow(strSensor4.dSensorY-vTargetState[i].dTargetPostionY,2)+pow(strSensor4.dSensorZ-vTargetState[i].dTargetPostionZ,2)); if(((m_dIvestiRg>m_dr1)&&(m_dIvestiRg>m_dr2)&&(m_dIvestiRg>m_dr3)&&(m_dIvestiRg>m_dr4))==0) { cout<<"目标超出传感器探测范围"<<endl; continue; } m_dtime1=m_dr1/m_dSoundVelocity; m_dtime2=abs(m_dr2-m_dr1)/m_dSoundVelocity; m_dtime3=abs(m_dr4-m_dr1)/m_dSoundVelocity; m_dtime4=abs(m_dr4-m_dr1)/m_dSoundVelocity; strTargetPolar.dTargetAzimuth=atan((m_dtime3-m_dtime4)/m_dtime2)/M_PI*180; strTargetPolar.dTargetPitch=acos(m_dSoundVelocity*sqrt(pow(m_dr2,2)+pow(m_dr3-m_dr4,2)/(2*m_dL))); strTargetPolar.dTargetR=(pow(m_dL,2)*(m_dtime2-m_dtime3-m_dtime4)-pow(m_dL,2)*sqrt(4*pow(m_dL,2)/pow(m_dSoundVelocity,2)-pow(m_dtime2,2)-pow(m_dtime3-m_dtime4,2)))/(m_dSoundVelocity*(pow(m_dtime2,2)+pow(m_dtime2-m_dtime3-m_dtime4,2)-4*pow(m_dL,2)/pow(m_dSoundVelocity,2))); } cout<<"目标方位角为:"<<strTargetPolar.dTargetAzimuth<<endl; cout<<"目标俯仰角为:"<<strTargetPolar.dTargetPitch<<endl; cout<<"目标径向距为:"<<strTargetPolar.dTargetR<<endl; return 0; }//end of get_polar ``` 编译的时候报错: --------------------Configuration: huo_pao_sheng721 - Win32 Debug-------------------- Compiling... CHuoPaoSheng721.cpp d:\vc6.0\msdev98\myprojects\huo_pao_sheng721\chuopaosheng721.h(17) : error C2143: syntax error : missing ';' before '<' d:\vc6.0\msdev98\myprojects\huo_pao_sheng721\chuopaosheng721.h(17) : error C2501: 'vector' : missing storage-class or type specifiers d:\vc6.0\msdev98\myprojects\huo_pao_sheng721\chuopaosheng721.h(17) : error C2143: syntax error : missing ';' before '<' D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(68) : error C2065: 'vTargetState' : undeclared identifier D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(68) : error C2228: left of '.size' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2228: left of '.dTargetPostionX' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2228: left of '.dTargetPostionY' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(70) : error C2228: left of '.dTargetPostionZ' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2228: left of '.dTargetPostionX' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2228: left of '.dTargetPostionY' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(71) : error C2228: left of '.dTargetPostionZ' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2228: left of '.dTargetPostionX' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2228: left of '.dTargetPostionY' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(72) : error C2228: left of '.dTargetPostionZ' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2228: left of '.dTargetPostionX' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2228: left of '.dTargetPostionY' must have class/struct/union type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2109: subscript requires array or pointer type D:\VC6.0\MSDev98\MyProjects\huo_pao_sheng721\CHuoPaoSheng721.cpp(73) : error C2228: left of '.dTargetPostionZ' must have class/struct/union type Error executing cl.exe. huo_pao_sheng721.exe - 29 error(s), 0 warning(s) 有好多是关于vector的,应该怎么改呢,怎么调通程序呢,小白真的不会了。大神们请帮帮忙。
EXTJS6.0饼状图报错,困惑我好几天了
![图片说明](https://img-ask.csdn.net/upload/201708/30/1504074320_829831.jpg) 我在百度上搜索的代码都试了一遍几乎都会报这个错 ``` Ext.onReady(function(){ Ext.define('MyApp.store.Expense', { extend : 'Ext.data.Store', alias : 'store.expense', fields : [ 'cat', 'spent' ], data : [ { "cat" : "Restaurant", "spent" : 100 }, { "cat" : "Travel", "spent" : 150 }, { "cat" : "Insurance", "spent" : 500 }, { "cat" : "Rent", "spent" : 1000 }, { "cat" : "Groceries", "spent" : 400 }, { "cat" : "Utilities", "spent" : 300 } ] }); var store = Ext.create("MyApp.store.Expense"); Ext.create('Ext.Container',{ renderTo : Ext.getBody(), width : 600, height : 500, layout : 'fit', items : [ { xtype : 'polar', legend : { docked : 'bottom' }, insetPadding : { top : 100, bottom : 20, left : 20, right : 40 }, store : store, series : [ { type : 'pie', angleField : 'spent', label : { field : 'cat', }, tooltip : { trackMouse : true, renderer : function(storeItem, item) { var value = ((parseFloat(storeItem.get('spent')/ storeItem.store.sum('spent')) * 100.0).toFixed(2)); this.setHtml(storeItem.get('cat') + ': ' + value + '%'); } } } ] } ] }); }); ``` 这是我的代码 ![图片说明](https://img-ask.csdn.net/upload/201708/30/1504074415_18803.jpg) 这是我页面上的引入,各位老铁们帮忙看下,困惑我很久了
opencv下笛卡尔坐标图片转化为极坐标图片无法显示彩色图片
uchar interpolate_bilinear(cv::Mat& mat_src, double ri, int rf, int rc, double ti, int tf, int tc) { double inter_value = 0.0; if (rf == rc && tc == tf) { inter_value = mat_src.ptr<uchar>(rc)[tc]; } else if (rf == rc) { inter_value = (ti - tf) * mat_src.ptr<uchar>(rf)[tc] + (tc - ti) * mat_src.ptr<uchar>(rf)[tf]; } else if (tf == tc) { inter_value = (ri - rf) * mat_src.ptr<uchar>(rc)[tf] + (rc - ri) * mat_src.ptr<uchar>(rf)[tf]; } else { double inter_r1 = (ti - tf) * mat_src.ptr<uchar>(rf)[tc] + (tc - ti) * mat_src.ptr<uchar>(rf)[tf]; double inter_r2 = (ti - tf) * mat_src.ptr<uchar>(rc)[tc] + (tc - ti) * mat_src.ptr<uchar>(rc)[tf]; inter_value = (ri - rf) * inter_r2 + (rc - ri) * inter_r1; } return (uchar)inter_value; } bool cartesian_to_polar(cv::Mat& mat_c, cv::Mat& mat_p, int img_d) { int color_num = mat_c.channels(); cout << "color_num=" << color_num << endl; mat_p = cv::Mat::zeros(img_d, img_d, CV_8UC1); //mat_p = cv::Mat::zeros(img_d, img_d, CV_8UC3); //mat_p = cv::Mat::zeros(img_d, img_d, color_num); int line_len = mat_c.rows; int line_num = mat_c.cols; double delta_r = (2.0*line_len) / (img_d - 1); //半径因子 double delta_t = 2.0 * PI / line_num; //角度因子 double center_x = (img_d - 1) / 2.0; double center_y = (img_d - 1) / 2.0; for (int i = 0; i < img_d; i++) { for (int j = 0; j < img_d; j++) { double rx = j - center_x; //图像坐标转世界坐标 double ry = center_y - i; //图像坐标转世界坐标 double r = std::sqrt(rx*rx + ry*ry); if (r <= (img_d - 1) / 2.0) { double ri = r * delta_r; int rf = (int)std::floor(ri); int rc = (int)std::ceil(ri); if (rf < 0) { rf = 0; } if (rc >(line_len - 1)) { rc = line_len - 1; } double t = std::atan2(ry, rx); if (t < 0) { t = t + 2.0 * PI; } double ti = t / delta_t; int tf = (int)std::floor(ti); int tc = (int)std::ceil(ti); if (tf < 0) { tf = 0; } if (tc >(line_num - 1)) { tc = line_num - 1; } mat_p.ptr<uchar>(i)[j] = interpolate_bilinear(mat_c, ri, rf, rc, ti, tf, tc); /* mat_p.ptr<Vec3b>(i, j)[0] = interpolate_bilinear(mat_c, ri, rf, rc, ti, tf, tc); mat_p.ptr<Vec3b>(i, j)[1] = interpolate_bilinear(mat_c, ri, rf, rc, ti, tf, tc); mat_p.ptr<Vec3b>(i, j)[2] = interpolate_bilinear(mat_c, ri, rf, rc, ti, tf, tc); */ } } } return true; }
王浩算法问题 能帮我分析下这段程序吗,需要一个大体的程序框架分析,这个王浩算法有点儿类似于编译原理。
``` int i=0; int stepcount=1; enum type{ and,or,detrusion,equal,level,variable }; struct node{ char *s; type kind; int polar; node *next; node *child; int start; }; struct step{ step *child; step *brother; node *lhead; node *rhead; int count; char name[30]; }; while(i<len){ // i<len if(s[i]=='|'){ //遇到 | if(!(s[i+1]<='Z'&&s[i+1]>='A'||s[i+1]<='z'&&s[i+1]>='a')&&s[i+1]!='1'&&s[i+1]!='0'&&s[i+1]!='('&&s[i+1]!='!'||i==0) return 0; current=(node*)malloc(sizeof(node)); current->kind=or; current->s=NULL; current->next=NULL; current->child=NULL; current->polar=polar; current->start=0; if(last->kind==level&&last->child==NULL){ last->child=current; } else{ last->next=current; } last=current; i++; } else if(s[i]=='&'){ //遇到 & if(!(s[i+1]<='Z'&&s[i+1]>='A'||s[i+1]<='z'&&s[i+1]>='a')&&s[i+1]!='1'&&s[i+1]!='0'&&s[i+1]!='('&&s[i+1]!='!'||i==0)return 0; current=(node*)malloc(sizeof(node)); current->kind=and; current->s=NULL; current->next=NULL; current->child=NULL; current->polar=polar; current->start=0; if(last->kind==level&&last->child==NULL){ last->child=current; } else{ last->next=current; } last=current; i++; } ```
Python霍兰德分析报错??
``` #霍兰德人格分析雷达图 import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['font.family']='SimHei' matplotlib.rcParams['font.sans-serif']=['SimHei'] radar_labels=np.array(['研究型(I)','艺术型(A)','社会型(S)',\ '企业型(E)','常规型(C)','现实型(R)']) nAttr=6 #数据值 data=np.array([[0.40,0.32,0.35,0.30,0.30,0.88], [0.85,0.35,0.30,0.40,0.40,0.30], [0.43,0.89,0.30,0.28,0.22,0.30], [0.30,0.25,0.48,0.85,0.45,0.40], [0.20,0.38,0.87,0.45,0.32,0.28], [0.34,0.31,0.38,0.40,0.92,0.28]]) data_labels=('工程师','实验员','艺术家','推销员','社会工作者','记事员') angles=np.linspace(0,2*np.pi,nAttr,endpoint=False) data=np.concatenate((data,[data[0]])) angles=np.concatenate((angles,[angles[0]])) fig=plt.figure(facecolor="white") plt.subplot(111,polar=True) plt.plot(angles,data,'bo-',color='gray',linewidth=1,alpha=0.2) plt.plot(angles,data,'o-',linewidth=1.5,alpha=0.2) plt.fill(angles,data,alpha=0.25) plt.thetagrids(angles*180/np.pi,radar_labels,frac=1.2) plt.figtext(0.52,0.95,'霍兰德人格分析',ha='center',size=20) legend=plt.legend(data_labels,loc=(0.94,0.80),labelspacing=0.1) plt.setp(legend.get_texts(),fontsize='small') plt.grid(True) plt.savefig('holland_radar.JPG') plt.show() ``` Traceback (most recent call last): File "D:/Python/霍兰德.py", line 28, in <module> plt.thetagrids(angles*180/np.pi,radar_labels,frac=1.2) File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\pyplot.py", line 1768, in thetagrids lines, labels = ax.set_thetagrids(*args, **kwargs) File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\projections\polar.py", line 1268, in set_thetagrids t.update(kwargs) File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\text.py", line 187, in update super().update(kwargs) File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\artist.py", line 916, in update ret = [_update_property(self, k, v) for k, v in props.items()] File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\artist.py", line 916, in <listcomp> ret = [_update_property(self, k, v) for k, v in props.items()] File "C:\Users\li\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\matplotlib\artist.py", line 912, in _update_property raise AttributeError('Unknown property %s' % k) AttributeError: Unknown property frac
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
记一次腾讯面试:进程之间究竟有哪些通信方式?如何通信? ---- 告别死记硬背
有一次面试的时候,被问到进程之间有哪些通信方式,不过由于之前没深入思考且整理过,说的并不好。想必大家也都知道进程有哪些通信方式,可是我猜很多人都是靠着”背“来记忆的,所以今天的这篇文章,讲给大家详细着讲解他们是如何通信的,让大家尽量能够理解他们之间的区别、优缺点等,这样的话,以后面试官让你举例子,你也能够顺手拈来。 1、管道 我们来看一条 Linux 的语句 netstat -tulnp | gr...
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
网络(8)-HTTP、Socket、TCP、UDP的区别和联系
TCP/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。 一、TCP与UDP的不同 1. 是否需要建立连接。 UDP在传送数据之前不需要先建立连接;TCP则提供面向连接的服务; 2. 是否需要给出确认 对方的传输层在收到UDP报文后,不需要给出任何确认,而 TCP需要给出确认报文,要提供可靠的、面向连接的传输服务。 3.虽然UDP不提供可靠交...
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
防劝退!数据结构和算法难理解?可视化动画带你轻松透彻理解!
大家好,我是 Rocky0429,一个连数据结构和算法都不会的蒟蒻… 学过数据结构和算法的都知道这玩意儿不好学,没学过的经常听到这样的说法还没学就觉得难,其实难吗?真难! 难在哪呢?当年我还是个小蒟蒻,初学数据结构和算法的时候,在忍着枯燥看完定义原理,之后想实现的时候,觉得它们的过程真的是七拐八绕,及其难受。 在简单的链表、栈和队列这些我还能靠着在草稿上写写画画理解过程,但是到了数论、图...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
开挂的人生!那些当选院士,又是ACM/IEEE 双料Fellow的华人学者们
昨日,2019年两院院士正式官宣,一时间抢占了各大媒体头条。 朋友圈也是一片沸腾,奔走相告,赶脚比自己中了大奖还嗨皮! 谁叫咱家导师就是这么厉害呢!!! 而就在最近,新一年度的IEEE/ACM Fellow也将正式公布。 作为学术届的顶级荣誉,不自然地就会将院士与Fellow作比较,到底哪个含金量更高呢? 学术君认为,同样是专业机构对学者的认可,考量标准不一,自然不能一概而论。 但...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
代码详解:如何用Python快速制作美观、炫酷且有深度的图表
全文共12231字,预计学习时长35分钟生活阶梯(幸福指数)与人均GDP(金钱)正相关的正则图本文将探讨三种用Python可视化数据的不同方法。以可视化《2019年世界幸福报告》的数据为例,本文用Gapminder和Wikipedia的信息丰富了《世界幸福报告》数据,以探索新的数据关系和可视化方法。《世界幸福报告》试图回答世界范围内影响幸福的因素。报告根据对“坎特里尔阶梯问题”的回答来确定幸...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
(经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
今年正式步入了大四,离毕业也只剩半年多的时间,回想一下大学四年,感觉自己走了不少弯路,今天就来分享一下自己大学的学习经历,也希望其他人能不要走我走错的路。 (一)初进校园 刚进入大学的时候自己完全就相信了高中老师的话:“进入大学你们就轻松了”。因此在大一的时候自己学习的激情早就被抛地一干二净,每天不是在寝室里玩游戏就是出门游玩,不过好在自己大学时买的第一台笔记本性能并不是很好,也没让我彻底沉...
如何写一篇技术博客,谈谈我的看法
前言 只有光头才能变强。 文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y 我一直推崇学技术可以写技术博客去沉淀自己的知识,因为知识点实在是太多太多了,通过自己的博客可以帮助自己快速回顾自己学过的东西。 我最开始的时候也是只记笔记,认为自己能看得懂就好。但如果想验证自己是不是懂了,可以写成技术博客。在写技术博客的...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
互联网公司的裁员,能玩出多少种花样?
裁员,也是一门学问,可谓博大精深!以下,是互联网公司的裁员的多种方法:-正文开始-135岁+不予续签的理由:千禧一代网感更强。95后不予通过试用期的理由:已婚已育员工更有责任心。2通知接下来要过苦日子,让一部分不肯同甘共苦的员工自己走人,以“兄弟”和“非兄弟”来区别员工。3强制996。员工如果平衡不了工作和家庭,可在离婚或离职里二选一。4不布置任何工作,但下班前必须提交千字工作日报。5不给活干+...
【设计模式】单例模式的八种写法分析
网上泛滥流传单例模式的写法种类,有说7种的,也有说6种的,当然也不排除说5种的,他们说的有错吗?其实没有对与错,刨根问底,写法终究是写法,其本质精髓大体一致!因此完全没必要去追究写法的多少,有这个时间还不如跟着宜春去网吧偷耳机、去田里抓青蛙得了,一天天的....
《面试宝典》:检验是否为合格的初中级程序员的面试知识点,你都知道了吗?查漏补缺
欢迎关注文章系列,一起学习 《提升能力,涨薪可待篇》 《面试知识,工作可待篇》 《实战演练,拒绝996篇》 也欢迎关注公 众 号【Ccww笔记】,原创技术文章第一时间推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《面试知识,工作可待篇》-Java笔试面试基础知识大全 前言 是不是感觉找工作面试是那么难呢? 在找工作面试应在学习的基础进行总结面试知识点,工作也指日可待,欢...
关于研发效能提升的思考
研发效能提升是最近比较热门的一个话题,本人根据这几年的工作心得,做了一些思考总结,由于个人深度有限,暂且抛转引入。 三要素 任何生产力的提升都离不开这三个因素:人、流程和工具,少了其中任何一个因素都无法实现。 人,即思想,也就是古人说的“道”,道不同不相为谋,是制高点,也是高层建筑的基石。 流程,即方法,也是古人说的“法”。研发效能的提升,也就是要提高投入产出比,既要增加产出,也要减...
微博推荐算法简述
在介绍微博推荐算法之前,我们先聊一聊推荐系统和推荐算法。有这样一些问题:推荐系统适用哪些场景?用来解决什么问题、具有怎样的价值?效果如何衡量? 推荐系统诞生很早,但真正被大家所重视,缘起于以”facebook”为代表的社会化网络的兴起和以“淘宝“为代表的电商的繁荣,”选择“的时代已经来临,信息和物品的极大丰富,让用户如浩瀚宇宙中的小点,无所适从。推荐系统迎来爆发的机会,变得离用户更近: 快...
GitHub 标星 1.6w+,我发现了一个宝藏项目,作为编程新手有福了!
大家好,我是 Rocky0429,一个最近老在 GitHub 上闲逛的蒟蒻… 特别惭愧的是,虽然我很早就知道 GitHub,但是学会逛 GitHub 的时间特别晚。当时一方面是因为菜,看着这种全是英文的东西难受,不知道该怎么去玩,另一方面是一直在搞 ACM,没有做一些工程类的项目,所以想当然的以为和 GitHub 也没什么关系(当然这种想法是错误的)。 后来自己花了一个星期看完了 Pyt...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
相关热词 c#导入fbx c#中屏蔽键盘某个键 c#正态概率密度 c#和数据库登陆界面设计 c# 高斯消去法 c# codedom c#读取cad文件文本 c# 控制全局鼠标移动 c# temp 目录 bytes初始化 c#
立即提问