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
GOOGLE AI PRO - 18 Month - Rs.500.00
Sanathbh
Updated:
Yesterday at 8:25 PM
📸 SIGMA 85mm F1.4 DG HSM | Art — Nikon Mount
romeshnonis
Updated:
Wednesday at 3:56 PM
Ad icon
Singapore V2Ray VPN for Tunneling
hu KANNA
Updated:
Monday at 9:03 PM
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Monday at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Sep 8, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Write a C++ Program...
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="viraj_slk" data-source="post: 7372505" data-attributes="member: 51932"><p><span style="font-size: 12px">Here ! the code is right in front of you bro! why are u asking for more? you only have to correct the sytaxes according to C++ now. don't expect me to go through C++ syntaxs now and do it. it's ur job. <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">again the code is:</span></p><p><span style="font-size: 12px">[CODE]</span></p><p><span style="font-size: 12px">arr[] = {1, 2, 3, 4, 5} // or whatever other numbers u want. this is our original array.</span></p><p><span style="font-size: 12px">new_arr[]; // new array we are going to build</span></p><p><span style="font-size: 12px">int p; // the new position for each element in array</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">for(i= 0; i < n; i++){</span></p><p><span style="font-size: 12px"> p = (i + x)%n; // remember n is the number of values in array & x is user input value</span></p><p><span style="font-size: 12px"> </span></p><p><span style="font-size: 12px"> new_arr[p] = arr[i]; </span></p><p><span style="font-size: 12px">} </span></p><p><span style="font-size: 12px">[/CODE]</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">now 'new_arr' array contains the shifted numbers. This is the code. Use ur syntaxes to write it in whatever language u want.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">to answer ur questions:</span></p><p><span style="font-size: 12px">no u don't have to give a size to the array. but if you want, give it the same size as the original. it's going to contain the same number of elements any way. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">use the for loop to fill the new array using the formula inside it that I described to you in the previous post.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"></span></p></blockquote><p></p>
[QUOTE="viraj_slk, post: 7372505, member: 51932"] [SIZE="3"]Here ! the code is right in front of you bro! why are u asking for more? you only have to correct the sytaxes according to C++ now. don't expect me to go through C++ syntaxs now and do it. it's ur job. :) again the code is: [CODE] arr[] = {1, 2, 3, 4, 5} // or whatever other numbers u want. this is our original array. new_arr[]; // new array we are going to build int p; // the new position for each element in array for(i= 0; i < n; i++){ p = (i + x)%n; // remember n is the number of values in array & x is user input value new_arr[p] = arr[i]; } [/CODE] now 'new_arr' array contains the shifted numbers. This is the code. Use ur syntaxes to write it in whatever language u want. to answer ur questions: no u don't have to give a size to the array. but if you want, give it the same size as the original. it's going to contain the same number of elements any way. use the for loop to fill the new array using the formula inside it that I described to you in the previous post. [/SIZE] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom