Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

array question

$
0
0
This program should determine whethet the integer is positive or negative. Then it should copy negative values into aryA and positive value into aryB. lastly, it should display how many values copied into aryA and aryB.

#include <iostream>
using namespace std;

int main()
{
int ary[4], aryA[4], aryB[4];
int count;
int a= 0;
int b= 0;

cout<<"Please enter 4 integer numbers : ";

for (int i=0;i<4;i++)

cin>>ary[4];

cout<<endl;

for (int count=0; count<4; count++)
{
if (ary[4]>=0)
{
b=count aryB[4];

}
else
{

a=count aryA[4];
}
}

cout<< "Array A has "<<a<<"values."<<endl;
cout<< "Array B has "<<b<<"values."<<endl;

return 0;
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>