So i need write program,but i don't know exactly how..
User inputs string of integers.If there is not odd number after which is even number i have print out only negative numbers.If there is odd number,which follows even number,i have to print out all positive numbers.And numbers must be printed from the end to beginning.
For example:
if user inputs: 2 -2 3 -5 5 2 69 -63 i have to print out 69 2 5 3 2
if user inputs 2 4 6 8 -10 8 6 -12 i have to print out -12 -10
hope you understand.sorry for bad english.
I am just begginner.
Here is what i have made so far.Just dont know how join together more than one for and if.
#include<iostream>
using namespace std;
int arr[50];
int sk;
int main()
{
cout<<"How many integers you want to input?"<<endl;
cin>>sk;
for (int i=0;i<sk;i++)
{cout<<"Enter "<<i+1<<". string number "<<endl;
cin>>arr[i];
}
int j=0;
for (j=0;j<sk;j++)
{ if (arr[j]%2!=arr[j+1]%2)
If all are odd,i have to print out only negative numbers
That is the same i wrote in the first post-If there is not odd number after which is even number i have print out only negative numbers.