السلام عليكم لدي مسأله عجزت عن التفكير فيها و لم اقدر علي حلها اتمني مساعدتي قبل إنتهاء الوقت : (
write a program that defines the following function:
.int ReadDate (int[]x)
read from the user an integer N follwed by N integers.the N integer will be saved in the parameter array x.the function returns the number of data items being read ,i.e .N
void printData (int[]x,int N)
prints the first N integers in array x .the items should be printed on the same line ,separated by ',' and with a fullstop '.' at the end ,followed by a new line.
bool allpositive (int []x,int N)
this function return true if all N integers in x are positive.
bool allsorted(int [] x, int N)
this function return true if all n integer in x are sorted in an ascending (nondecreasing) order.
void computeSum(int[], int [], int N)
this function will set elements in array y such that the value of y[k] (k=0..N)is equal to the sum of all items from x[0] to x[k] (inclusive.)
the main program will call ReadData to get the data from the user,and then it will print the following information:
1.print the data using printData.
2.print if the data is sorted or not.
3.print if the data is all positive or not.
4.call computeSum and prints the resulting array.
you assume tht the user will not enter more than 100 integers.
study the following sample input /output . the text in bool is typed by the user while the regular text is printed by the program.
I need data : 5 -4 12 16 36 42
Data is: -4 , 12, 16 36, 42.
The data IS sorted.
The Data IS NOT all positive .
Data Sum is: -4,8 ,24 ,60 ,102.
Thank you
و هذا حلي انا
#include <iostream>
using namespace std;
int readData (int x[]){
int N;
cin >> N;
x []= N;
return N;
}
void printData (int x[] , int N){
bool allPositive (int x[] , int N){
for(int k=0 ;k<N ;k++){
if(x[k]<=0)
return false;
}
return true ;
bool allstored ( int
int main(){
printData ( int x[] , N )
system ("pause");
return (0);
}
write a program that defines the following function:
.int ReadDate (int[]x)
read from the user an integer N follwed by N integers.the N integer will be saved in the parameter array x.the function returns the number of data items being read ,i.e .N
void printData (int[]x,int N)
prints the first N integers in array x .the items should be printed on the same line ,separated by ',' and with a fullstop '.' at the end ,followed by a new line.
bool allpositive (int []x,int N)
this function return true if all N integers in x are positive.
bool allsorted(int [] x, int N)
this function return true if all n integer in x are sorted in an ascending (nondecreasing) order.
void computeSum(int[], int [], int N)
this function will set elements in array y such that the value of y[k] (k=0..N)is equal to the sum of all items from x[0] to x[k] (inclusive.)
the main program will call ReadData to get the data from the user,and then it will print the following information:
1.print the data using printData.
2.print if the data is sorted or not.
3.print if the data is all positive or not.
4.call computeSum and prints the resulting array.
you assume tht the user will not enter more than 100 integers.
study the following sample input /output . the text in bool is typed by the user while the regular text is printed by the program.
I need data : 5 -4 12 16 36 42
Data is: -4 , 12, 16 36, 42.
The data IS sorted.
The Data IS NOT all positive .
Data Sum is: -4,8 ,24 ,60 ,102.
Thank you
و هذا حلي انا
#include <iostream>
using namespace std;
int readData (int x[]){
int N;
cin >> N;
x []= N;
return N;
}
void printData (int x[] , int N){
bool allPositive (int x[] , int N){
for(int k=0 ;k<N ;k++){
if(x[k]<=0)
return false;
}
return true ;
bool allstored ( int
int main(){
printData ( int x[] , N )
system ("pause");
return (0);
}