Soft care "scrie" programe

Presupunem ca avem o baza de date formata din n fisiere care contin probleme de programare (indiferent de limbajul de programare) deja rezolvate. Aceste probleme sunt cuantificate dupa ce sunt despartite in date de intrare, date de iesire, prelucrari, folosind un limbaj specializat numit pseudocod (cate o intrare pe linie). Presupunem ca avem o problema noua cuantificata in acelasi mod ca mai sus. Programul va cauta "asemanari", intre datele continute in cele n fisiere si datele continute de programul nou. Primele 2 fisiere care au numar maxim de asemanari cu cel ce contine cerintele programului nou vor fi scrise in alt fisier text. Spre exemplificare avem n vectori (varianta simplificata) care contin date "cuantificate" sub forma de numere intregi si avem un vector care contie datele din programul care trebuie rezolvat. Exemplu: n= 3 v=(1,4,6), (2,7,8,9), (3,2,6) si v1=(1,6). Intre v1 si primul vector exista 2 asemanari (1 si 6) iar intre v1 si al treilea vector exista o asemanare (6). Primul si al treilea vector vor fi afisati pe ecran. Exemplificam o mica parte din program in limbajul java, in care datele se afla deja stocate in vectori, nu in fisiere. /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package asemanrivectori;
import java.util.*;
public class AsemanriVectori {
public static void main(String[] args) {
// TODO code application logic here
System.out.print("n = ");
Scanner citescn=new Scanner(System.in);
int n=citescn.nextInt();
System.out.print("m = ");
Scanner citescm=new Scanner(System.in);
int m=citescm.nextInt();
int v[][]=new int[20][20];
int i,j;
for (i=1; i<=n; i++){
for (j=1; j<=m; j++) {
System.out.print("v[" + i + "][" + j + "]= ");
Scanner citescv=new Scanner(System.in);
v[i][j]=citescv.nextInt();
}
}
for (i=1; i<=n; i++){
for (j=1; j<=m; j++){
System.out.print(v[i][j]+" ");
}
System.out.println
}
System.out.print("p = ");
Scanner citescp=new Scanner(System.in);
int p=citescp.nextInt();
int vector[]=new int[20];
int k;
for (k=1; k<=p; k++){
System.out.print("vector[" + k + "]= ");
Scanner citesteve=new Scanner(System.in);
vector[k]=citesteve.nextInt();
}
System.out.println("vectorul de comparat este:");
for (k=1; k<=p; k++) {
System.out.print(vector[k] + " ");
}
System.out.println();

int nras[]=new int[20];
for (i=1; i<=n; i++) {
int asem=0;
for (j=1; j<=m; j++) {
if (v[i][j]!=0) {
for (k=1; k<=p; k++)
if (v[i][j]==vector[k]) {
asem++;
}
}
}

nras[i]=asem;
System.out.println("nras[" + i + "]= " + nras[i]);
}
int ordine[]=new int[20];
for (i=1; i<=n; i++) {
ordine[i]=i;
// System.out.println("ordine[" + i + "]= " + ordine[i]);
} int aux;
for (i=1; i<=n-1; i++){
for (j=i+1; j<=n; j++){
if (nras[i] aux=nras[i]; nras[i]=nras[j]; nras[j]=aux; aux=ordine[i]; ordine[i]=ordine[j];
ordine[j]=aux;
}
}
}
System.out.println("ordinea vectorilor" );
for (i=1; i<=n; i++) {
System.out.println(ordine[i]);
}
int poz1=ordine[1];
int poz2=ordine[2];
for (j=1; j<=m; j++) {
System.out.print(v[poz1][j] + " ");
}
System.out.println();
for (j=1; j<=m; j++) {
System.out.print(v[poz2][j] + " ");
}
System.out.println(); }
}