Article View: be.comp.programming
Article #4354Re: Oefening in C++ (schaakbord)
From: -=Bacchant=-
Date: Fri, 22 Aug 2003 18:33
Date: Fri, 22 Aug 2003 18:33
49 lines
2386 bytes
2386 bytes
euhm,
bedankt voor al jullie code, maar ik heb het ondertussen al
opgelost(jippie!) met de relatief simpele code:
#include <iostream>
using namespace std;
int main()
{ int n ;char ch ,cg,t,d;
cout <<"Programma dat een schaakbord tekent van een ingevoerd getal en
teken"
<<"\nGeef een getal(kleiner dan 9 voor mooi resultaat): ";
cin >> n;
cout <<"Geef een teken voor zwart: ";
cin >> t;
cout << "Geef een teken voor wit: ";
cin >>d;
ch = d;
cg = ch;
for(int c=0;c<n;c++){
for(int k=0;k<n;k++){
for(int y=0; y<n;y++){
for(int x=0;x<n;x++){
cout << ch;
}
(ch == t)? (ch = d): (ch = t);
}
cout << "\n";
ch = cg;
}
(cg== t)? (cg = d):(cg = t);
ch = cg;
}
return 0;
}
Jullie voorbeelden zijn technisch gezien ongetwijfeld veel beter, maar zoals
de heer Loots terecht opmerkte, is dit veel te ingewikkeld voor een
beginnend C++-programmeur...
P.S: Ik vraag me af waarom ik eigenlijk nog C++ leer, iedereen lijkt het al
te kennen...
mvg,
Bacchant
Technical Details
Message-ID:
<bi5nc4$jdb$1@reader11.wxs.nl>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!mephistopheles.news.clara.net!news.clara.net!skynet.be!skynet.be!newsgate.cistron.nl!news2.euro.net!newsfeed.wxs.nl!textnews.wxs.nl!not-for-mailReferences:
<be8qtj$ec3$1@reader08.wxs.nl> <seiPa.14411$7h.14326@afrodite.telenet-ops.be> <3f0ee5dd$0$6531$afc38c87@sisyphus.news.be.easynet.net> <pJCPa.1149$F92.228@afrodite.telenet-ops.be> <3f0f0a48$0$6529$afc38c87@sisyphus.news.be.easynet.net>Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit X-Google-Thread: fcea4,c3467730e88beae5 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2003-08-22 11:25:45 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!mephistopheles.news.clara.net!news.clara.net!skynet.be!skynet.be!newsgate.cistron.nl!news2.euro.net!newsfeed.wxs.nl!textnews.wxs.nl!not-for-mail From: "-=Bacchant=-" <bacchantd@hotmail.com> Newsgroups: be.comp.programming Subject: Re: Oefening in C++ (schaakbord) Date: Fri, 22 Aug 2003 20:33:43 +0200 Organization: Planet Internet Lines: 51 Message-ID: <bi5nc4$jdb$1@reader11.wxs.nl> References: <be8qtj$ec3$1@reader08.wxs.nl> <seiPa.14411$7h.14326@afrodite.telenet-ops.be> <3f0ee5dd$0$6531$afc38c87@sisyphus.news.be.easynet.net> <pJCPa.1149$F92.228@afrodite.telenet-ops.be> <3f0f0a48$0$6529$afc38c87@sisyphus.news.be.easynet.net> Reply-To: "-=Bacchant=-" <bacchantd@hotmail.com> NNTP-Posting-Host: 81.11.146.33 X-Trace: reader11.wxs.nl 1061576900 19883 81.11.146.33 (22 Aug 2003 18:28:20 GMT) X-Complaints-To: abuse@planet.nl NNTP-Posting-Date: 22 Aug 2003 18:28:20 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106