[請問] C++問題
看板C_and_CPP (C/C++)作者starmoon0918 (烏漆麻黑澤)時間16年前 (2009/04/05 17:47)推噓0(0推 0噓 0→)留言0則, 0人參與討論串1/2 (看更多)
※ [本文轉錄自 ask 看板]
作者: starmoon0918 (烏漆麻黑澤) 看板: ask
標題: [請問] C++問題
時間: Sun Apr 5 17:24:58 2009
我用要用C++寫指數運算
EX:i^j
其中我要用if迴圈去寫..
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int size =9;
int i=0,j=0;
cout<<endl<<" |";
for(i=1;i<=size;i++)
{
cout<<setw(3)<<i<<" ";
}
cout<<endl;
for(i=0;i<=size;i++)
{
cout<<"____";
}
for(i=1;i<=size;i++)
{
cout<<endl<<setw(3)<<i<<" |";
for(j=1;j<=size;j++)
{
cout<<setw(3)<<" "; <-----這邊不知道要怎麼寫
}
}
cout<<endl;
return 0;
}
寫到這邊...
我想寫成i^j...
這樣要怎麼去寫??
順便一問..
教學的是用C++6
而我去下載的是2005 Express
當我案執行的時候
視窗會自動關閉
去哪裡調可以讓視窗一直停留
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.25.118.165
※ 編輯: starmoon0918 來自: 163.25.118.165 (04/05 17:25)
→
04/05 17:35,
04/05 17:35
推
04/05 17:36,
04/05 17:36
→
04/05 17:44,
04/05 17:44
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.25.118.165
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章