Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Strict warning: No AI . Solve it immediately. AX 0 8 Jambo, ninahitaji usaidizi kwa kazi hii katika C + + . Nimechapisha moja hapo

Strict warning: No AI. Solve it immediately.
AX08
Jambo, ninahitaji usaidizi kwa kazi hii katika C++. Nimechapisha moja hapo awali lakini suluhisho halikufanya kazi bado kuna makosa. (Huwezi kurekebisha chochote kando na sehemu ya //KOSI YAKO.
KUMBUKA HUWEZI KUREKEBISHA MSTARI HUU KATIKA MSIMBO : string toString(){ return p1.toString()+" to "+ p2.toString(); }( NIMECHAPIA KABLA, MAJIBU HABADILI MSTARI HUU DAIMA)
Muundo wa Sehemu 2
Nakili nambari yako kutoka kwa Muundo wa Sehemu (mjenzi na vijiti vya wanachama - unavihitaji kwa shida hii.
Kisha ongeza nambari ya kitendakazi cha moveBy(int deltaX, int deltaY) kwenye Sehemu ili tuweze kuhamisha sehemu hiyo kwa kiasi fulani katika x (deltaX) na kiasi fulani katika y (deltaY). Kuhamisha sehemu kunapaswa kusogeza ncha zote mbili.
Tunafafanua msimbo wote ndani ya tamko la darasa. Kwa hivyo hauitaji Sehemu :: mbele ya ufafanuzi wako wa mjenzi. Hii inafanya kazi kwa miradi rahisi ya faili moja kama hii. Usifanye hivi katika kazi.
MSIMBO:
#pamoja na
#pamoja na
kutumia nafasi ya majina std;
alama ya darasa {
Privat:
int x =0;
int y =0;
umma:
Hatua(){}
Pointi(int xVal, int yVal){
moveBy(xVal, yVal);
}
kamba toString(){
return to_string(x)+","+ to_string(y);
}
void moveBy(int xVal, int yVal){
x += xVal;
y += yVal;
}
};
sehemu ya darasa {
umma:
string toString(){ return p1.toString()+" to "+ p2.toString(); }(HUWEZI KUREKEBISHA MSTARI HUU PIA)
//Usirekebishe chochote juu au juu ya mstari hapa chini
//CODE_YAKO_HAPA CHINI
//CODE_YAKO
void moveBy(int deltaX, int deltaY)// sogeza sehemu kwa xVal na yVal
{
p1-> moveBy(deltaX, deltaY);
p2-> moveBy(deltaX, deltaY);
}
// HII ndio sehemu niliyoongeza lakini bado inaonyesha makosa.
Sehemu(Pointi *p1, Pointi *p2)
{
hii->p1= p1;
hii->p2= p2;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions