⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1dlg.cpp

📁 绘制柱状图的资源
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        pDC->MoveTo(pt1); //线的起点 
		pDC->LineTo(pt6);  //线的终点
		pDC->MoveTo(pt1);  //线的起点
		pDC->LineTo(pt8);  //线的终点
		pDC->MoveTo(pt4);  //线的起点
		pDC->LineTo(pt10);  //线的终点
		pDC->MoveTo(pt4);  //线的起点
		pDC->LineTo(pt12); //线的终点

		ReleaseDC(pDC); //释放CDC


		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMy1Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}
/*
void   CMy1Dlg::OnClean()
 {   
	CDC   *pDC   =   GetDC();   
	CRect   rc;   
	GetClientRect(&rc);   
	pDC->FillSolidRect(&rc,   RGB(255,   255,   255));   
    ReleaseDC(pDC);   
 }
*/

void CMy1Dlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	int i;
	n1=n2=n3=n4=n5=0;
	//	FILE file;
	int a[50]; 

	FILE *fpTxt;

/*	CString str ;
	int nCur = m_kemu.GetCurSel();
	if( nCur>=0 )
	m_kemu.GetLBText(nCur,str);*/
	CString str,str1 ; 
	if(m_kemu.GetCurSel()>=0)
	{
		m_kemu.GetLBText(m_kemu.GetCurSel(),str);
	}
		if(m_banji11.GetCurSel()>=0)
	{
		m_banji11.GetLBText(m_banji11.GetCurSel(),str1);
	}

		if(str1=="071"&&str=="离散")
	{
		if( ( fpTxt = fopen ("ls1.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
		system("cls"); 
	
		 
	}
	if(str1=="071"&&str=="概率")
	{
		if( ( fpTxt = fopen ("gl1.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
		system("cls"); 
	
		 
	}

	if(str1=="071"&&str=="英语")
	{
		if( ( fpTxt = fopen ("yy1.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt); 
//		OnPaintBackGround(pevent);
		system("cls"); 
	
	}

	if(str1=="071"&&str=="物理")
	{
		if( ( fpTxt = fopen ("wl1.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
	
	 system("cls");
	}
	//OnPaintBackGround(e);
	
//	 UpdateData(true);

//	Invalidate(false); 
	if(str1=="072"&&str=="离散")
	{
		if( ( fpTxt = fopen ("ls2.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
		system("cls"); 
	
		 
	}
	if(str1=="072"&&str=="概率")
	{
		if( ( fpTxt = fopen ("gl2.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
		system("cls"); 
	
		 
	}

	if(str1=="072"&&str=="英语")
	{
		if( ( fpTxt = fopen ("yy2.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt); 
//		OnPaintBackGround(pevent);
		system("cls"); 
	
	}

	if(str1=="072"&&str=="物理")
	{
		if( ( fpTxt = fopen ("wl2.txt","r")) == NULL ) 
		{ 
			MessageBox("打开文件失败","系统警告",MB_OK); 
			return; 
		} 

		else
		{
			for( i=0;i<50;i++) 
			{ 
				fscanf(fpTxt, "%d\n", &a[i]); 

				if(a[i]>=60&&a[i]<=70)
					n1++;
				if(a[i]>=71&&a[i]<=80)
					n2++;
				if(a[i]>=81&&a[i]<=90)
					n3++;
				if(a[i]>=91&&a[i]<=100)
					n4++;
				if(a[i]>=0&&a[i]<=59)
					n5++;
			} 
		}
		fclose(fpTxt);
//		OnPaintBackGround(pevent);
	
	 system("cls");
	}
	//OnPaintBackGround(e);
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -