PDA

View Full Version : مبتدی: حل مسئله Deitel & Deitel



WebConsole
دوشنبه 14 مرداد 1392, 08:09 صبح
درود

دوستان من امروز داشتم تمرین 2-23 دیتل & دیتل رو حل میکردم ( انتشارات ناقوس) ولی متاسفانه به یک مشکلی برخودم اونم اینه که وقتی من با استفاد از cout میخوام یک مربع رو چاپ کنم 3 ضلع بالا ، پایین و چپ درست چاپ میشن ولی نمیدونم چجوری باید ضلع سمت رو چاپ کنم ( نمیدونم چجوری ببرم به سمت راست ) با خالی هم تست کردم لطفا راهنمایی کنید اینم کد :


#include "stdafx.h"
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
cout<<"*********\n";
cout<<"*\n*\n*\n*\n*\n*\n*\n*\n";
cout<<"*********\n";

}

WebConsole
دوشنبه 14 مرداد 1392, 08:37 صبح
مشکل حل شد جواب رو اینجا میزارم تا دوستان دیگه هم استفاده کنن :

http://up.gbanner.ir/images/7a9odtyfkmdpp252dyp.jpg

#include "stdafx.h"
#include <iostream>

using std::cout;

int main()
{
cout<<"*********\n";
cout<<"* *\n* *\n* *\n* *\n* *\n* *\n* *\n* *\n";
cout<<"*********\n";
}

WebConsole
دوشنبه 14 مرداد 1392, 08:43 صبح
بیضی :

http://up.gbanner.ir/images/rvw26vs4pina1rnmtwg2.jpg

#include "stdafx.h"
#include <iostream>

using std::cout;

int main()
{
cout<<" *** \n";
cout<<" * *\n* *\n* *\n* *\n* *\n* *\n* *\n * *\n";
cout<<" *** \n";
}

WebConsole
دوشنبه 14 مرداد 1392, 08:48 صبح
پیکان :

http://up.gbanner.ir/images/52vnbbphmfcag7yl8ym.jpg

#include "stdafx.h"
#include <iostream>

using std::cout;

int main()
{
cout<<" * \n";
cout<<" *** \n";
cout<<"*****\n";
cout<<" * \n * \n * \n * \n * \n * \n * \n";
}

WebConsole
دوشنبه 14 مرداد 1392, 08:56 صبح
لــوزی :

http://up.gbanner.ir/images/usd09eonfq365st2zsz.jpg

#include "stdafx.h"
#include <iostream>

using std::cout;

int main()
{
cout<<" *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" * *\n";
cout<<" *\n";
}