online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// Programa que funde dos vectores ordenados // Octubre de 2009 Con Clase, Salvador Pozo #include <iostream> using namespace std; void Mostrar(int*, int); int main() { int vector1[10] = { 3, 4, 6, 9, 12, 15, 17, 19, 22, 24 }; int vector2[10] = { 1, 5, 8, 11, 13, 14, 21, 23, 25, 30 }; int vectorR[20]; int *p, *q, *r; int *u1, *u2; p = vector1; q = vector2; r = vectorR; u1 = &vector1[9]; u2 = &vector2[9]; cout << "Vectores de entrada:" << endl; Mostrar(vector1, 10); Mostrar(vector2, 10); while(p <= u1 && q <= u2) { if(*p < *q) { *r++ = *p++; } else { *r++ = *q++; } } // Llegados a este punto, quedarán elementos por // copiar en uno de los vectores, así que hay // que copiarlos incondicionalmente: while(p <= u1) { *r++ = *p++; } while(q <= u2) { *r++ = *q++; } cout << "Resultado:" << endl; Mostrar(vectorR, 20); return 0; } void Mostrar(int *v, int n) { int *f = &v[n]; // Puntero a posición siguiente al último elemento while(v < f) { cout << *v << " "; v++; } cout << endl; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue