[Cpp]/** Copyright (c) 2012, School of Computer Science, Yantai University * All rights reserved. * file name: test. cpp * Author: Fan Lulu * Completion Date: July 15, December 21, 2012 * version: v1.0 ** input Description: none * Problem description: write a program to determine whether there are identical numbers in two ordered arrays. * Program output: the final result. * Problem Analysis: * Algorithm Design: omitted */# include <iostream> using namespace std; bool existthesame (int * a, int n1, int * B, int n2 ); int main () {int a [] = {,}; int B [] = {, 10}; int n1 = sizeof () /sizeof (a [0]); int n2 = sizeof (B)/sizeof (B [0]); bool flag = existthesame (a, n1, B, n2 ); if (flag = true) cout <"two sorted arrays contain the same number! \ N "; else cout <" two sorted arrays do not have the same number! \ N "; return 0;} bool existthesame (int * a, int n1, int * B, int n2) {int I, j; for (I = 0; I <n1; I ++) {for (j = 0; j <n2; j ++) {if (a [I] = B [j]) return true; else return false ;}}}