i am a bit confused on how to start this i have to write a for loop to read in 10 number , write bubble sort having 2 nested for loops and writing a loop to output to sorted array

int main ()
{	
	
		int total_neg=0;// intialize 
		int total_pos=0;
		int total=0;
		int num=0;
		int cnt=0;
		cnt=0;


		while ( cnt<10)//starting a while loop

{
		cout<<"enter an integer:";

		cin>>num;
	
		if	(num < 0)

{

		total_neg =total_neg + num;//declaring the formulas for the while loop
}
		else 
{
		total_pos = total_pos + num;
}

		total=total+num;

		cnt=cnt+1;


}
else
(
	 total_avg = total_pos+total_neg/10

}

		cout<<" total negatives are "<<total_neg<<endl;
		cout<<"total average is "<<total_avg<<endl;
		cout<<"total postives are "<<total_pos<<endl;
		cout<<"total of all numbers are"<<total<<endl;
		return 0;
}

i know how to convert the while to a for loop but i am having trouble implementing the psuedocode for a bubble sort into my program

the code i found was

int main()
procedure bubbleSort( A : list of sortable items ) defined as:
  do
    swapped := false
    for each i in 0 to length(A) - 2 inclusive do:
      if A[ i ] > A[ i + 1 ] then
        swap( A[ i ], A[ i + 1 ] )
        swapped := true
      end if
    end for
  while swapped
end procedure

any suggestions / help much appreciated

sorry i am not looking to spend money

commented: +1 for being hilarious +36

sorry i am not looking to spend money

This internet-thing is kinda new for you isn't it?

Start by changing each line in the pseudo code into real code. Use the correct syntax for each command you use. Then add code before this conversion to add the things needed to make it compile -- like variable/array definitions, main(), header files, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.