日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

DEV C++如何不需要通过建项目可以调试程序

發布時間:2023/12/10 c/c++ 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DEV C++如何不需要通过建项目可以调试程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1點擊文件

2、開始寫一段類的程序

#include<iostream>
using namespace std;
class Point ? ?//點類定義?
{
? ? int x,y; ?//點的x和y坐標
public:
? ? void lnitPoint(int,int); ? //設置坐標
int GetX(){ return x;} ? //取x坐標
int GetY() {return y;} ? ?//取y坐標
void Print(); ? ? ? ? ? ?//輸出點的坐標
};?
//類外定義兩個成員函數
void Point::lnitPoint(int a,int b)
{
x=a;
y=b;
}
void Point::Print() ? ? ?//輸出x 和y的坐標?
{
cout<<'['<<x<<","<<y<<']';
}
class Circle ?//圓類定義
{
private:
? double radius; ? ? ?//定義半徑對象 (變量)
? Point Center; ? ? ? //定義圓心對象(變量)
public:
? ? ? ?void lnitCircle(double,Point); ? ?//設置圓類的數據
? double GetRadius(); ? ? //取半徑
? Point GetCenter(); ? ?//取圓心
? double Area(); ? ? ?//計算面積
? void Print(); ? ? ?//輸出圓心坐標和半徑
};
//類外定義成員函數
void Circle::lnitCircle(double r, Point p) ? //對Circle的類進行數據處理?
{
radius=(r>=0?r:0);
Center = p;
}
double Circle::GetRadius(){return radius;}
Point Circle::GetCenter(){return Center;}
double Circle::Area(){return 3.14159*radius*radius;}
void Circle::Print()
{
cout<<"Center=";
Center.Print();
cout<<";Radius="<<radius<<endl;
}
//主函數
int main()
{
Point p,center; ? ? ?//定義point 類?
p.lnitPoint(30,50); ? ? //調用point中處理數據的函數?
center.lnitPoint(120,80); ? //調用point 中處理私有數據的函數?
Circle c; ? ? //定義Circle類?
c.lnitCircle(10.0,center); ? ?//調用Circle中處理私有數據的函數?

cout<<"Point p:";
p.Print(); ? ? //調用Point中的輸出x和y的函數?
cout<<endl;
cout<<"Circle c:";
c.Print(); ? ?//調用Circle中的輸出中心點和半徑的函數?
cout<<"The center of circle c:";
c.GetCenter().Print(); ?//調用Circle返回center值的函數和輸出中心值和半徑的值?
cout<<"\nThe area of circle c:"<<c.Area()<<endl; ?//調用Circle面積的函數?
return 0;

}

3、在工具中--》編譯選項--》代碼優化--》連接器--》產生調試信息改為yes

4、先編譯

5就可以直接調試了

總結

以上是生活随笔為你收集整理的DEV C++如何不需要通过建项目可以调试程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。