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
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Oct 14, 2026
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
ElaKiri Programmer's Club
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="MihiCherub" data-source="post: 18096369" data-attributes="member: 238676"><p>[PHP]struct items</p><p>{</p><p> string name, itemID;</p><p> int qty;</p><p> double unitPirce;</p><p>} records [10]; //record size[/PHP]</p><p>[PHP]int addRecord(int rec)</p><p>{</p><p> int cnt = rec;</p><p> int a;</p><p></p><p> while(cnt < 10)</p><p> {</p><p> cout << "\nItem ID: ";</p><p> cin >> records[cnt].itemID;</p><p></p><p> cout << "Item Name: ";</p><p> cin >> records[cnt].name;</p><p></p><p> cout << "Item qty: ";</p><p> cin >> records[cnt].qty;</p><p></p><p> cout << "Item Unit Price: ";</p><p> cin >> records[cnt].unitPirce;</p><p></p><p> cout << "Record Added.\n";</p><p> cnt++;</p><p></p><p> cout << "\nEnter New Record?\n1-'Yes' 2-'No' Enter: ";</p><p> cin >> a;</p><p></p><p> if(a==2)</p><p> break;</p><p></p><p> if(cnt==10)</p><p> printf("\nMaximum Records count Exceeded.");</p><p> }</p><p> return cnt;</p><p>}[/PHP][PHP]void printRecord(int rec)</p><p>{</p><p> int cnt = rec;</p><p> if(cnt > 0)</p><p> {</p><p> cout << "\Item Id\tName\tQty\tUnitPrice\n\n";</p><p></p><p> for(int i=0; i< cnt; i++)</p><p> cout << records[i].itemId <<"\t\t"<< records[i].name << "\t"<< records[i].qty << "\t"<< records[i].unitPrice <<"\n";</p><p> }</p><p> else</p><p> printf("Item Record cannot found.");</p><p>}[/PHP][PHP]int main()</p><p>{</p><p> int opt, rows=0;</p><p> printf("\n---Perera & Sons System---\n");</p><p></p><p> while(true)</p><p> {</p><p> printf("\n1.Add Item Records");</p><p> printf("\n2.Display all Items");</p><p></p><p> printf("\n\nPlease choose one of the above options: ");</p><p> scanf("%d", &opt);</p><p></p><p> if(opt == 1)</p><p> rows = addRecord(rows);</p><p> else if(opt == 2)</p><p> printRecord(rows);</p><p> else</p><p> printf("Error.");</p><p> }</p><p> getch();</p><p></p><p> return 0;</p><p>}[/PHP]</p></blockquote><p></p>
[QUOTE="MihiCherub, post: 18096369, member: 238676"] [PHP]struct items { string name, itemID; int qty; double unitPirce; } records [10]; //record size[/PHP] [PHP]int addRecord(int rec) { int cnt = rec; int a; while(cnt < 10) { cout << "\nItem ID: "; cin >> records[cnt].itemID; cout << "Item Name: "; cin >> records[cnt].name; cout << "Item qty: "; cin >> records[cnt].qty; cout << "Item Unit Price: "; cin >> records[cnt].unitPirce; cout << "Record Added.\n"; cnt++; cout << "\nEnter New Record?\n1-'Yes' 2-'No' Enter: "; cin >> a; if(a==2) break; if(cnt==10) printf("\nMaximum Records count Exceeded."); } return cnt; }[/PHP][PHP]void printRecord(int rec) { int cnt = rec; if(cnt > 0) { cout << "\Item Id\tName\tQty\tUnitPrice\n\n"; for(int i=0; i< cnt; i++) cout << records[i].itemId <<"\t\t"<< records[i].name << "\t"<< records[i].qty << "\t"<< records[i].unitPrice <<"\n"; } else printf("Item Record cannot found."); }[/PHP][PHP]int main() { int opt, rows=0; printf("\n---Perera & Sons System---\n"); while(true) { printf("\n1.Add Item Records"); printf("\n2.Display all Items"); printf("\n\nPlease choose one of the above options: "); scanf("%d", &opt); if(opt == 1) rows = addRecord(rows); else if(opt == 2) printRecord(rows); else printf("Error."); } getch(); return 0; }[/PHP] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom