Originariamente inviato da Scara95
C++
codice:
#include <iostream>
#define N 10
using namespace std;

int main() {
	int v[N];
	int c;
	bool ord;

	for(c = 0; c < N;c++) {
		cout << "inserisci un numero: ";
		cin >> v[c];
	}
	
	ord = true;
	for(c=0;c < (N - 1);c++) {
		if(!(v[c] <= v[c+1])) {
			ord = false;
			break;
		}
	}
	
	if(ord)
		cout << "Il vettore è ordinato" << endl;
	else
		cout << "Il vettore è disordinato" << endl;

	system("pause");
}
e C:
codice:
#include <stdio.h>
#include <stdbool.h>
#define N 10

int main() {
	int v[N];
	int c;
	bool ord;

	for(c = 0; c < N;c++) {
		printf("inserisci un numero: ");
		scanf("%d",&v[c]);
	}
	
	ord = true;
	for(c=0;c < (N - 1);c++) {
		if(!(v[c] <= v[c+1])) {
			ord = false;
			break;
		}
	}
	
	if(ord)
		printf("Il vettore è ordinato\n");
	else
		printf("Il vettore è disordinato\n");

	system("pause");
}
@Scara95 grazie per il codice , scusami per l'ignoranza ma potresti spiegarmi ord=false e if(ord) cosa significano? mentre ord è la variabile che poi devo stampare giusto?