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
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Today at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Sep 7, 2026
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sep 6, 2026
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Problems and Troubleshooting
C Programe Help Plz
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="Topology" data-source="post: 9798790" data-attributes="member: 343193"><p><span style="font-size: 15px"><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">මෙන්න පිළිතුර නමුත් මේක මම ලිව්වේ C++ වලින්.</span></span></span></span></p><p><span style="font-size: 15px"><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">C </span></span></span><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">වල</span></span></span><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">ට</span></span></span><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">හරවා ගන්න</span></span></span>.</span></p><p><span style="font-size: 15px"><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">සමාවෙන්න මේච්චරයි මට උදව් කරන්න පුලුවන් මොකද මම වැඩිය C දන්නේ නෑ.</span></span></span></span></p><p><span style="font-size: 15px"><span style="color: #000000"><span style="font-family: 'Verdana'"><span style="font-family: 'Potha'">නමුත් C වලයි C++ වලයි වැඩි වෙනසක් නෑ. Syntax පමණයි</span></span></span>.</span></p><p><span style="font-size: 15px">and NO IOSTREAM in C .!!</span></p><p></p><p>[CODE]</p><p>#include <iostream></p><p></p><p>using namespace std;</p><p></p><p></p><p>struct buf{</p><p> int values[100];</p><p>};</p><p></p><p>int main()</p><p>{</p><p> int i=0;</p><p> int totNum[100];</p><p> struct buf mainBuff;</p><p> </p><p> //ACCEPT THE VALUES</p><p> while(1)</p><p> {</p><p> cout << "press 0 to exit from the loop" << endl;</p><p> cin>>totNum[i];</p><p></p><p> if(totNum[i] == 0)</p><p> {</p><p> cin.ignore();</p><p> break;</p><p> }</p><p> i++;</p><p> }</p><p> </p><p> //THREAD 1 STORE IN AN ARRAY</p><p> //the values are already in an array</p><p> </p><p> //THREAD 2 SPLIT AND STORE IN THE SHARED BUFFER</p><p> for(int j=0 ;j<i;j++)</p><p> {</p><p> mainBuff.values[j] = totNum[j];</p><p> }</p><p> </p><p> //NOW READ THEM FROM TEH BUFFER AND STORE IN An ARRAY</p><p> int totNumCus[100];</p><p></p><p> for(int l=0;l<i;l++)</p><p> {</p><p> totNumCus[l] = mainBuff.values[l];</p><p> }</p><p> </p><p> int tot=0;</p><p> </p><p> //NOW CALCULATE THE TOT AND DISPLAY THE ANSWER</p><p> for(int m=0;m<i;m++)</p><p> {</p><p> tot += totNumCus[m];</p><p> }</p><p> </p><p> cout << "the final answer is " << tot << endl;</p><p></p><p> cin.get();</p><p>return 0; </p><p>}</p><p></p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="Topology, post: 9798790, member: 343193"] [SIZE=4][COLOR=#000000][FONT=Verdana][FONT=Potha]මෙන්න පිළිතුර නමුත් මේක මම ලිව්වේ C++ වලින්. C [/FONT][/FONT][/COLOR][COLOR=#000000][FONT=Verdana][FONT=Potha]වල[/FONT][/FONT][/COLOR][COLOR=#000000][FONT=Verdana][FONT=Potha]ට[/FONT][/FONT][/COLOR][COLOR=#000000][FONT=Verdana][FONT=Potha]හරවා ගන්න[/FONT][/FONT][/COLOR]. [COLOR=#000000][FONT=Verdana][FONT=Potha]සමාවෙන්න මේච්චරයි මට උදව් කරන්න පුලුවන් මොකද මම වැඩිය C දන්නේ නෑ. නමුත් C වලයි C++ වලයි වැඩි වෙනසක් නෑ. Syntax පමණයි[/FONT][/FONT][/COLOR]. and NO IOSTREAM in C .!![/SIZE] [CODE] #include <iostream> using namespace std; struct buf{ int values[100]; }; int main() { int i=0; int totNum[100]; struct buf mainBuff; //ACCEPT THE VALUES while(1) { cout << "press 0 to exit from the loop" << endl; cin>>totNum[i]; if(totNum[i] == 0) { cin.ignore(); break; } i++; } //THREAD 1 STORE IN AN ARRAY //the values are already in an array //THREAD 2 SPLIT AND STORE IN THE SHARED BUFFER for(int j=0 ;j<i;j++) { mainBuff.values[j] = totNum[j]; } //NOW READ THEM FROM TEH BUFFER AND STORE IN An ARRAY int totNumCus[100]; for(int l=0;l<i;l++) { totNumCus[l] = mainBuff.values[l]; } int tot=0; //NOW CALCULATE THE TOT AND DISPLAY THE ANSWER for(int m=0;m<i;m++) { tot += totNumCus[m]; } cout << "the final answer is " << tot << endl; cin.get(); return 0; } [/CODE] [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom