Sponsor Area

NCERT Solutions for Class 12 Help.html Computer Science With C++ Chapter 6 Data File Handling

Data File Handling Here is the CBSE Help.html Chapter 6 for Class 12 students. Summary and detailed explanation of the lesson, including the definitions of difficult words. All of the exercises and questions and answers from the lesson's back end have been completed. NCERT Solutions for Class 12 Help.html Data File Handling Chapter 6 NCERT Solutions for Class 12 Help.html Data File Handling Chapter 6 The following is a summary in Hindi and English for the academic year 2025-26. You can save these solutions to your computer or use the Class 12 Help.html.

Question 1
CBSEENCO12011720

Write a function SWAP2BEST (int ARR[], int Size) in C++ to modify the content of the array in such a way that the elements, which are multiples of 10 swap with the value present in the very next position in the array.

For example:

If the content of array ARR is 90,56,45,20,34,54

The content of array ARR should become 56,90,45,34,20,54

Solution
#include <iostream.h>
#include <conio.h>
void SWAP2BEST(int ARR[], int Size); 
int main ()
{
//Here we are taking different values for more perfect result with more
//numbers of array elements. You can change the values and number of array
//elements as per your choice.
	int ListofNum[8] = {6, 28, 30, 17, 50, 45, 80, 82};
	clrscr();
	SWAP2BEST(ListofNum, 8 ) ; 
	return 0;
}
void SWAP2BEST(int ARR[], int Size)
{
	int i= 0; int temp=0;
#include <iostream.h> 
#include <conio.h>
	void SWAP2BEST(int ARR[], int Size); 
	int main ()
	{
//Here we are taking different values for more perfect result with more
//numbers of array elements. You can change the values and number of array
//elements as per your choice.
		int ListofNum[8] = {6, 28, 30, 17, 50, 45, 80, 82};
		clrscr(); SWAP2BEST(ListofNum, 8 ) ;
		return 0;
	}
	void SWAP2BEST(int ARR[], int Size)
	{
		int i= 0; int temp=0;
for (i = 0; i < Size; ++i)//loop for printing original array values
{
	cout<<ARR[i]<<;
}
cout<<endl;
for (i = 0; i < Size; ++i)
{
	if(ARR[i+1]=='\0')
	{
	}
	else
	{
		if(ARR[i+1]%10==0)
		{
			temp=ARR[i];
			ARR[i]=ARR[i+1];
			ARR[i+1]=temp;
		}
	}
}
for (i = 0; i < Size; ++i)	//loop for printing swapped array value
{
	cout<<ARR[i]<<;
}
}

Sponsor Area