- 0
C#, Parallel Arrays- Passing Array by Reference
Asked by
thehappygoldenlady,
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By xMorpheousx416 · Posted
lol See... one is only 100% when it's by itself. I live for exceptions to the rule... our talk point was in reference in comparing Vista (not SP1/2) release vs. 7. Any OS will run stable once enough work has been put into it... hell, even Windows 95 had six versions before she was finally complete(d)... just about, what, six or seven months before 98 became available? -
3uTools 3.26.007 by Razvan Serea 3uTools is a powerful iOS management tool that allows users to efficiently handle their iPhone or iPad without relying on iTunes. It offers seamless data transfer, one-click backup and restore, firmware updates, and a built-in file explorer for easy access to system files. Users can also manage apps, contacts, and media, including photos, videos, and ringtones, all within a simple and intuitive interface. For optimization and maintenance, 3uTools provides battery health monitoring, real-time device information, and system cleanup tools. It also includes features like screen recording, video conversion, and iCloud backup management, making it an essential tool for iOS users looking for greater control over their devices. Key features of 3uTools: iOS device management App installation and removal Firmware downloads and updates Backup and restore functions Data transfer between iOS and PC Ringtone creation Custom wallpaper management Device flashing File system explorer Battery health monitoring Screen capture and recording Video and photo management iCloud backup support Flashing and restoring iOS without data loss 3uTools 3.26.007 changelog: Easy Flash supports iOS 26.0 flashing. Optimized Virtual Location. Fixed some known bugs. Download: 3uTools 3.26.007 | 186.0 MB (Freeware) Download: 3uTools 32-bit | 192.0 MB View: 3uTools Home Page | macOS | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
-
By Borken_ · Posted
The development time of this Operating System will have competition with the development time of Star Citizen 😂 -
By Michael Scrip · Posted
I saw the 300 in the image and thought it was the number of cores! 🤣 -
By David Uzondu · Posted
Threads is getting a feature Reddit has had for nearly a decade by David Uzondu Back in January, reverse engineer Alessandro Paluzzi (@alex193a) first uncovered that Threads was working on spoiler tags. Now, Meta CEO Mark Zuckerberg (@zuck) has made it official: the feature is in testing. It is a straightforward tool for hiding content, especially text, behind a block that you have to click to reveal, perfect for discussing the ending of your favorite show without ruining the experience for others. It is also, notably, a feature that Reddit has had since January 2017. https://www.threads.com/@zuck/post/DK-BydcJHkF For a platform aiming to be a town square for public discourse, not having a native way to handle spoilers is a small but noticeable handicap for communities focused on pop culture. In a press release, Meta told TechCrunch that popular shows like The Last of Us trended heavily on the app, which the company frames as a sign of a "growing community of entertainment and pop culture enthusiasts." The new feature also supports images so that you can hide shocking visuals or text-filled screenshots. From the images Meta shared, it seems to work just as Paluzzi uncovered months ago. Users with access to the test can highlight text in the composer, and a "mark spoiler" option will appear in a small menu. This method is purely button-based, unlike on Reddit, where users have the option of either using a similar editor button or manually typing out the markdown command >!like this!< to hide their text. This update does not exist in a vacuum. After several months of feeling incomplete, the platform has been getting features that users have actually been asking for. We have seen this with the recent DMs feature, also in testing, which finally gives people a way to have private chats without jumping over to other platforms like Instagram.
-
-
Recent Achievements
-
treker_ed went up a rank
Explorer
-
CHUNWEI went up a rank
Apprentice
-
1337ish went up a rank
Veteran
-
john.al went up a rank
Rookie
-
patrickft456 earned a badge
Week One Done
-
-
Popular Contributors
-
Tell a friend
Question
thehappygoldenlady
I am working on an Assignment that asks me to do this:
Develop a C# console application that implements two parallel arrays in Main, one to hold double values called item_price and the other to hold strings called item_name. Each array will hold 5 values. Use an initializer to fill the item_price array with the values 15.50, 50.99, 25.00, 115.49, 75.25. Use an initializer to fill the item_name array with the values "Widget", "Thingy", "Ratchet", "Clanger", "Fracker". This application will use a method to change the corresponding prices for items based on a price point and a multiplier which will require double value types. The inputs for the price and multiplier are input from the console.
Create two static methods, one called changePrices and one called printit. When the changePrices method is called from Main you should pass the item_price array by reference, the price point and price difference values input from the console to it. The changePrices method should loop through the item price array and check the price point to determine the increase in price for each price array element. The basic computation is:
if the current price is less than the price point then set the price equal to the current price plus the current price times the price multiplier
In the printit method print the item name and the corresponding item price to the console as shown in the output example below.
The price for item Widget is $15.50
The price for item Thingy is $50.99
The price for item Ratchet is $25.00
The price for item Clanger is $115.49
The price for item Fracker is $75.25
Enter the price cutoff point (eg $15.00) $60.00
Enter the percentage price change (eg 0.25) 0.15
The price for item Widget is $17.83
The price for item Thingy is $58.64
The price for item Ratchet is $28.75
The price for item Clanger is $115.49
The price for item Fracker is $75.25
Press any key to continue . . .
As shown in the sample output, your program will first use the printit method to print the parallel arrays as they are, next take inputs for the price point and the price change multiplier and then after the changePrices method has been executed run the printit method once again to show any changed prices.
I keep getting an error stating, "Cannot implicitly convert type 'double' to 'int'. An explicit conversion exist (are you missing a cast?) on
Line 32 Console.WriteLine("The price for item " + (item_name[x]) + "is " + item_price[x]);
as well as several more errors. How can I fix this?
Here is my code:
Link to comment
https://www.neowin.net/forum/topic/1256148-c-parallel-arrays-passing-array-by-reference/Share on other sites
19 answers to this question
Recommended Posts