Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
c++ sub menu
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Arkham Knight" data-source="post: 16460776" data-attributes="member: 500755"><p><span style="font-size: 12px"><img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /> ඔන්න ගැහුවා හරියටම තියෙනවා නමුත් මේකේ තියෙන්නේ ROWS 2 ක් විතරයි.</span></p><p><span style="font-size: 12px">උබ ඉතුරු row ටික ගහගන්න එතකොට මේක වැඩ කරන විදියත්, code එකේ basic principle එකත් බලාගන්න පුලුවන්.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">සාරාංශය වශයෙන් කිව්වොත්.</span></p><p><span style="font-size: 12px">මේකේ Table එක Align කරන්න setw() function එක ඕන වෙනවා ඒක නැතුව table එක align කරන්න බෑ හරියට, ඒකට iomanip කියන library එකට access වෙන්න වෙනවා (මේක header file එකක්)</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">ඊට පස්සේ ID එක ගහලා Student ගේ marks බලන්න ඕනේ නම් IF conditional statmenet </span><span style="font-size: 12px">එක යොදාගන්න පුලුවන්. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">අවසානයේදි High,Low mark එක ගන්න නම් bubble sort එක යොදාගන්න ඕනේ. මේක කරන්න කලින් final mark ටික ගන්න වෙනම single dimension array එකකට ඊට පස්සේ ඒ array එක sort කරන්න bubble sort </span><span style="font-size: 12px"><span style="font-size: 12px">algorithm </span>එක හරහා (මම ඒක ගහලා ඇති අවසානයේදි) මතක ඇතුව sorting එකේදි low value එක මුලටත්, high value එක අගටත් දාගන්න.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">ඊට පස්සේ array එකේ 0 space එකට access වෙලා low </span><span style="font-size: 12px"><span style="font-size: 12px">mark </span>එකත්</span></p><p><span style="font-size: 12px">array එකේ length - 1 (අවසාන space එක) space එකට access වෙලා high mark එකත් ගන්න පුලුවන්, මේක හරි සරලයි. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">මෙතනට මම code එක upload කරා. copy කරද්දි toggle wrap එක off කරලා copy කරන්න නැත්නම් VS එකේ code එක messy විදියට paste වෙයි paste කරන කොට. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"><a href="http://pastebin.com/DfBBRAMi#" target="_blank">http://pastebin.com/DfBBRAMi#</a></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">ඒ වගේම Elakiri එකේත් ගහලා ඇති. code එක අනිවාර්යෙන්ම වැඩ AND tested Visual Studio එකේ. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"></span></p><p>[CODE]</p><p>#include <iostream></p><p>#include <iomanip></p><p></p><p>using namespace std;</p><p></p><p>/*</p><p>1. View all studentdata</p><p>2. View a student’s data using the ID</p><p>3. Show the highest and the lowest final marks </p><p>*/</p><p></p><p>void allStudentData();</p><p>void idStudent();</p><p>void showHighLowMarks();</p><p>void menu();</p><p></p><p>int main()</p><p>{</p><p> menu();</p><p>}</p><p></p><p>int sR[3][5];</p><p>void menu()</p><p>{</p><p> //|StudentID 0 | TMA1 1| TMA2 2| BCAT 3| Final 4</p><p> //student column names</p><p> sR[0][0] = 0;</p><p> sR[0][1] = 1;</p><p> sR[0][2] = 2;</p><p> sR[0][3] = 3;</p><p> sR[0][4] = 4;</p><p></p><p> //student One</p><p> sR[1][0] = 1232;</p><p> sR[1][1] = 10;</p><p> sR[1][2] = 23;</p><p> sR[1][3] = 45;</p><p> sR[1][4] = 56;//final mark</p><p></p><p> //student two</p><p> sR[2][0] = 2343;</p><p> sR[2][1] = 45;</p><p> sR[2][2] = 43;</p><p> sR[2][3] = 24;</p><p> sR[2][4] = 78;//final mark</p><p></p><p></p><p> cout << "---------- Menu -----------" << endl;</p><p> cout << "" << endl;</p><p> cout << "1. View all studentdata" << endl;</p><p> cout << "2. View a student’s data using the ID" << endl;</p><p> cout << "3. Show the highest and the lowest final marks " << endl;</p><p> cout << "" << endl;</p><p> cout << "Type a desired value from the given menu and press the ENTER key to proceed" << endl;</p><p> int givenVal = 0;</p><p> cin >> givenVal;</p><p> cin.ignore();</p><p></p><p> switch (givenVal)</p><p> {</p><p> case 1:</p><p> allStudentData();</p><p> break;</p><p> case 2:</p><p> idStudent();</p><p> break;</p><p> case 3:</p><p> showHighLowMarks();</p><p> break;</p><p> default:</p><p> cout << "an Error is occurred" << endl;</p><p> cin.clear();//clear the input buffer</p><p> menu();</p><p> break;</p><p> }</p><p> cin.get();</p><p>}</p><p></p><p>void allStudentData()</p><p>{ </p><p> cout << " "; for(int i=0;i<40;i++){ cout << "_";} cout << endl;</p><p> cout << "|" << setw(11) << "StudentID 0" << "|" << setw(6) << "TMA1 1" << "|" << setw(6) << "TMA2 2" << "|" << setw(6) << "BCAT 3" << "|" << setw(7) << "Final 4|" << endl;</p><p> cout << "|" << setw(11) << sR[1][0] << "|" << setw(6) << sR[1][1] << "|" << setw(6) << sR[1][2] << "|" << setw(6) << sR[1][3] << "|" << setw(7) << sR[1][4] << "|" << endl;</p><p> cout << "|" << setw(11) << sR[2][0] << "|" << setw(6) << sR[2][1] << "|" << setw(6) << sR[2][2] << "|" << setw(6) << sR[2][3] << "|" << setw(7) << sR[2][4] << "|" << endl;</p><p> cout << " "; for(int i=0;i<40;i++){ cout << "_";} cout << endl;</p><p>}</p><p></p><p>void idStudent()</p><p>{</p><p> cout << "Id the of the student to see" << endl;</p><p> int stdID;</p><p> cin >> stdID;</p><p> cin.ignore();</p><p> for(int i=0;i<3;i++)</p><p> {</p><p> for(int j=0;j<5;j++)</p><p> {</p><p> if(sR[i][j] == stdID)</p><p> {</p><p> cout << "Student ID.is :" << sR[i][j] << endl;</p><p> cout << "TMA1.......is :" << sR[i][j+1] << endl;</p><p> cout << "TMA2.......is :" << sR[i][j+1] << endl;</p><p> cout << "BCAT.......is :" << sR[i][j+2] << endl;</p><p> cout << "Final......is :" << sR[i][j+4] << endl;</p><p> break;</p><p> }</p><p> }</p><p> }</p><p> </p><p>}</p><p></p><p>void showHighLowMarks()</p><p>{</p><p> int fM[2];//for receiving final marks</p><p> int k=0;</p><p></p><p> for(int i=1;i<3;i++)</p><p> {</p><p> for(int j=0;j<5;j++)</p><p> {</p><p> if(j==4)//final mark value</p><p> {</p><p> fM[k] = sR[i][j];</p><p> k++;</p><p> }</p><p> }</p><p> }</p><p></p><p> //sorting</p><p> for(int i=0;i<1;i++)</p><p> {</p><p> int temp = fM[i+1];</p><p> if(temp < fM[i])</p><p> {</p><p> fM[i+1] = fM[i];</p><p> fM[i] = temp;</p><p> }</p><p> }</p><p></p><p> cout << "The Highest value is..." << fM[1] << endl;</p><p> cout << "The Lowest value is...." << fM[0] << endl;</p><p>}</p><p></p><p></p><p></p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="Arkham Knight, post: 16460776, member: 500755"] [SIZE=3]:) ඔන්න ගැහුවා හරියටම තියෙනවා නමුත් මේකේ තියෙන්නේ ROWS 2 ක් විතරයි. උබ ඉතුරු row ටික ගහගන්න එතකොට මේක වැඩ කරන විදියත්, code එකේ basic principle එකත් බලාගන්න පුලුවන්. සාරාංශය වශයෙන් කිව්වොත්. මේකේ Table එක Align කරන්න setw() function එක ඕන වෙනවා ඒක නැතුව table එක align කරන්න බෑ හරියට, ඒකට iomanip කියන library එකට access වෙන්න වෙනවා (මේක header file එකක්) ඊට පස්සේ ID එක ගහලා Student ගේ marks බලන්න ඕනේ නම් IF conditional statmenet [/SIZE][SIZE=3]එක යොදාගන්න පුලුවන්. අවසානයේදි High,Low mark එක ගන්න නම් bubble sort එක යොදාගන්න ඕනේ. මේක කරන්න කලින් final mark ටික ගන්න වෙනම single dimension array එකකට ඊට පස්සේ ඒ array එක sort කරන්න bubble sort [/SIZE][SIZE=3][SIZE=3]algorithm [/SIZE]එක හරහා (මම ඒක ගහලා ඇති අවසානයේදි) මතක ඇතුව sorting එකේදි low value එක මුලටත්, high value එක අගටත් දාගන්න. ඊට පස්සේ array එකේ 0 space එකට access වෙලා low [/SIZE][SIZE=3][SIZE=3]mark [/SIZE]එකත් array එකේ length - 1 (අවසාන space එක) space එකට access වෙලා high mark එකත් ගන්න පුලුවන්, මේක හරි සරලයි. මෙතනට මම code එක upload කරා. copy කරද්දි toggle wrap එක off කරලා copy කරන්න නැත්නම් VS එකේ code එක messy විදියට paste වෙයි paste කරන කොට. [url]http://pastebin.com/DfBBRAMi#[/url] ඒ වගේම Elakiri එකේත් ගහලා ඇති. code එක අනිවාර්යෙන්ම වැඩ AND tested Visual Studio එකේ. [/SIZE] [CODE] #include <iostream> #include <iomanip> using namespace std; /* 1. View all studentdata 2. View a student’s data using the ID 3. Show the highest and the lowest final marks */ void allStudentData(); void idStudent(); void showHighLowMarks(); void menu(); int main() { menu(); } int sR[3][5]; void menu() { //|StudentID 0 | TMA1 1| TMA2 2| BCAT 3| Final 4 //student column names sR[0][0] = 0; sR[0][1] = 1; sR[0][2] = 2; sR[0][3] = 3; sR[0][4] = 4; //student One sR[1][0] = 1232; sR[1][1] = 10; sR[1][2] = 23; sR[1][3] = 45; sR[1][4] = 56;//final mark //student two sR[2][0] = 2343; sR[2][1] = 45; sR[2][2] = 43; sR[2][3] = 24; sR[2][4] = 78;//final mark cout << "---------- Menu -----------" << endl; cout << "" << endl; cout << "1. View all studentdata" << endl; cout << "2. View a student’s data using the ID" << endl; cout << "3. Show the highest and the lowest final marks " << endl; cout << "" << endl; cout << "Type a desired value from the given menu and press the ENTER key to proceed" << endl; int givenVal = 0; cin >> givenVal; cin.ignore(); switch (givenVal) { case 1: allStudentData(); break; case 2: idStudent(); break; case 3: showHighLowMarks(); break; default: cout << "an Error is occurred" << endl; cin.clear();//clear the input buffer menu(); break; } cin.get(); } void allStudentData() { cout << " "; for(int i=0;i<40;i++){ cout << "_";} cout << endl; cout << "|" << setw(11) << "StudentID 0" << "|" << setw(6) << "TMA1 1" << "|" << setw(6) << "TMA2 2" << "|" << setw(6) << "BCAT 3" << "|" << setw(7) << "Final 4|" << endl; cout << "|" << setw(11) << sR[1][0] << "|" << setw(6) << sR[1][1] << "|" << setw(6) << sR[1][2] << "|" << setw(6) << sR[1][3] << "|" << setw(7) << sR[1][4] << "|" << endl; cout << "|" << setw(11) << sR[2][0] << "|" << setw(6) << sR[2][1] << "|" << setw(6) << sR[2][2] << "|" << setw(6) << sR[2][3] << "|" << setw(7) << sR[2][4] << "|" << endl; cout << " "; for(int i=0;i<40;i++){ cout << "_";} cout << endl; } void idStudent() { cout << "Id the of the student to see" << endl; int stdID; cin >> stdID; cin.ignore(); for(int i=0;i<3;i++) { for(int j=0;j<5;j++) { if(sR[i][j] == stdID) { cout << "Student ID.is :" << sR[i][j] << endl; cout << "TMA1.......is :" << sR[i][j+1] << endl; cout << "TMA2.......is :" << sR[i][j+1] << endl; cout << "BCAT.......is :" << sR[i][j+2] << endl; cout << "Final......is :" << sR[i][j+4] << endl; break; } } } } void showHighLowMarks() { int fM[2];//for receiving final marks int k=0; for(int i=1;i<3;i++) { for(int j=0;j<5;j++) { if(j==4)//final mark value { fM[k] = sR[i][j]; k++; } } } //sorting for(int i=0;i<1;i++) { int temp = fM[i+1]; if(temp < fM[i]) { fM[i+1] = fM[i]; fM[i] = temp; } } cout << "The Highest value is..." << fM[1] << endl; cout << "The Lowest value is...." << fM[0] << endl; } [/CODE] [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom