0

For my school project, I need to create a console application. But I am very new to all this, so I don't have much experience.

I need to make an application which adds 400 names to my database (first array with 20 first names, and a second array with 20 last names). Each member of the first array should be matched with each member of the second array. So the final result should be 400 person names.

Does anybody have an idea how to get started?

Marvin
  • 229
  • 1
  • 3
  • 11

2 Answers2

0

Maybe you can be more specific? You don't even say which language you are writing in..

Also "googling" could help you quit a lot. I would like to give you some tips where to find it etc, but I don't know the language you want want so..

I have come up with these links for you, just searching blind here...

If you are using Perl : How to merge two arrays, alternating values from each array, in perl

Java: Join two arrays in Java?

vb.net: Join arrays in VB.NET

Clean up your question and try it again ;)

Community
  • 1
  • 1
Jerre_111
  • 79
  • 1
  • 9
0

I think you can use this (I cout name and lastname together for myself and it's not important):

#include <iostream>
#include <string>
using namespace std;
int main()
{
    int k = 0;
string name[20] = /*{ some thing}*/;
string lastname[20] = /*{ some thing}*/;
string database[400];
for(int i = 0 ; i < 20 ; i++ )
{
    for (int j = 0 ; j < 20 ; j++ )
    {
        database[k] = name[i] + " " + lastname[j];
        k++;
        cout<<database<<endl;
    }
}
return 0;
}

you can go to this link and learn more about string for example (operator part) http://www.cplusplus.com/reference/string/string/ and see also http://www.cplusplus.com/doc/tutorial/arrays/ for array

Alireza Sanaee
  • 465
  • 1
  • 7
  • 21