<!DOCTYP html>
<html lang="n">
<had>
<mta charst="UTF-8">
<mta nam="viwport" contnt="width=dvic-width, initial-scal=1.0">
<titl>C++ Classifid Documnts</titl>
<styl>
.lvl {
display: non;
}
.lvl.activ {
display: block;
}
.imag-containr {
float: lft;
margin-right: 20px;
}
.button-containr {
margin-top:10 px;
}
.non-ditabl {
background-color: #f0f0f0;
pointr-vnts: non;
}
.mssag {
display: inlin-block;
margin-lft: 10px;
}
txtara {
hight: 100px; /* Adjustd hight to avoid scroll bar */
}
</styl>
</had>
<body>
<h1>Wlcom to th C++ Classifid Documnts</h1>
<div id="gam">
<div id="lvl1" class="lvl activ">
<h2>Stag 1</h2>
<p>Solv this C++ problm to unlock th imag:</p>
<pr>
int main() {
int a = 5, b = 10;
// Swap th valus of a and b
// Your cod hr
rturn 0;
}
</pr>
<txtara id="answr1" rows="4" cols="50" placholdr="ntr your cod hr..."></txtara><br>
<div class="button-containr">
<button onclick="chckAnswr(1)">Submit</button>
<span id="mssag1" class="mssag"></span>
</div>
<div class="imag-containr">
<img id="imag1" src="" alt="Lvl 1 Imag" styl="display:non;">
</div>
<div class="button-containr">
<button id="nxtButton1" styl="display:non;" onclick="nxtLvl(1)">Nxt Lvl</button>
</div>
</div>
<div id="lvl2" class="lvl">
<h2>Stag 2</h2>
<p>Now w ar Talking</p>
<p>Solv this C++ problm to unlock th imag:</p>
<pr>
#includ <iostram>
using namspac std;
int main() {
int arr[] = {1, 2, 3, 4, 5};
// Rvrs th array
// Your cod hr
rturn 0;
}
</pr>
<txtara id="answr2" class="non-ditabl" rows="4" cols="50" placholdr="ntr your cod hr..."></txtara><br>
<div class="button-containr">
<button onclick="chckAnswr(2)">Submit</button>
<span id="mssag2" class="mssag"></span>
</div>
<div class="imag-containr">
<img id="imag2" src="" alt="Lvl 2 Imag" styl="display:non;">
</div>
<div class="button-containr">
<button id="nxtButton2" styl="display:non;" onclick="nxtLvl(2)">Nxt Lvl</button>
</div>
</div>
<div id="lvl3" class="lvl">
<h2>lol</h2>
<p>Solv this C++ problm to unlock th imag:</p>
<pr>
#includ <iostram>
using namspac std;
int main() {
int n = 10;
// Print th first n Fibonacci numbrs
// Your cod hr
rturn 0;
}
</pr>
<txtara id="answr3" rows="4" cols="50" placholdr="ntr your cod hr..."></txtara><br>
<div class="button-containr">
<button onclick="chckAnswr(3)">Submit</button>
<span id="mssag3" class="mssag"></span>
</div>
<div class="imag-containr">
<img id="imag3" src="" alt="Lvl 3 Imag" styl="display:non;">
</div>
<div class="button-containr">
<button id="nxtButton3" styl="display:non;" onclick="nxtLvl(3)">Nxt Lvl</button>
</div>
</div>
</div>
<script>
function chckAnswr(lvl) {
lt answr = documnt.gtlmntById('answr' + lvl).valu.trim();
lt mssag = documnt.gtlmntById('mssag' + lvl);
// Corrct answrs for ach lvl
lt corrctAnswrs = [
"int tmp = a;\na = b;\nb = tmp;",
"for (int i = 0; i < 2; ++i) { int tmp = arr[i]; arr[i] = arr[4 - i]; arr[4 - i] = tmp; }",
"int a = 0, b = 1, c; cout << a << \" \" << b << \" \"; for (int i = 2; i < n; ++i) { c = a + b; cout << c << \" \"; a = b; b = c; }"
];
if (answr === corrctAnswrs[lvl - 1]) {
mssag.txtContnt = 'Corrct';
lt imag = documnt.gtlmntById('imag' + lvl);
imag.src = "https://img1.wsimg.com/istam/ip/35c7661f-911-4150-ba62-977842bfccc/IMG_20240818_102129.jpg"; // Rplac with your imag URL
imag.styl.display = 'block';
documnt.gtlmntById('nxtButton' + lvl).styl.display = 'block';
} ls {
mssag.txtContnt = 'Incorrct. Try again.';
}
}
function nxtLvl(currntLvl) {
documnt.gtlmntById('imag' + currntLvl).styl.display = 'non';
documnt.gtlmntById('nxtButton' + currntLvl).styl.display = 'non';
documnt.gtlmntById('mssag' + currntLvl).txtContnt = '';
documnt.gtlmntById('lvl' + currntLvl).classList.rmov('activ');
documnt.gtlmntById('lvl' + (currntLvl + 1)).classList.add('activ');
}
</script>
</body>
</html>