954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Arrays in c/c++ language

I have two programs that i have to write by next friday (april 1 ) but i have no idea how to do them. Can someone please help me out. These are the conditions for the 1st one:

1) read floating point numbers into an array until teh sum of those numbers exceeeds 100.At teh element where the sum becomes greater than 100, store a -1.0 to denote that end of the array. Now print the number of elements in the aarray, not including the -1.0.

Second one:
2) initialize an integer array with six elements. find the largest element and swap it with the number in the first element. FOr example, if the array is 40, 80,20,50,90,30, after the swap the array should become 90,80,20,50,40,30.

ncat_08
Newbie Poster
2 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

Read the Announcement .

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

This is all i have so far and the point where i stopped. The condition for this problem is posted in the forums.
I would appreciate if you could help me.


const int point = 6;
float point[6], sum = 0.0;
int index;
count<<"Enter the floats: ";
for(index=0; sum !=100; index = index + 1)
{
cin< 100)
point[index] = -1.0;
cout<<"

ncat_08
Newbie Poster
2 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You