#include <iostream.h>
#include <string.h>
#include <vector.h>
#include <fstream.h>
using std::string;
using std::vector;
void function(vector<string>&fn,vector<string>&fnum,vector<string>&ln,vector<string>&lnum);
void main()
{
	  ifstream fin,f2,f3,f4;
	  //First name input
	  vector <string> fname(25);
	fin.open("firstname.dat", ios :: in); 
	for( int i= 0;i<25;i++)
		fin>>fname[i];
	fin.close();
	//Second name input
	  vector <string> fnum(25);
	f2.open("firstnum.dat", ios :: in); 
	for(int i= 0;i<25;i++)
		f2>>fnum[i];
	f2.close();
	//Third Name
	  vector <string> lname(25);
	f3.open("lastname.dat", ios :: in); 
	for( int i= 0;i<25;i++)
		f3>>lname[i];
	f3.close();
	//Forth Name
	  vector <string> lnum(25);
	f4.open("lastnum.dat", ios :: in); 
	for( int i= 0;i<25;i++)
		f4>>lnum[i];
	f4.close();
	function(fname,fnum,lname,lnum);		
	
}
void function(vector<string>&fn,vector<string>&fnum,vector<string>&ln,vector<string>&lnum)
{
	for(int i=0;i<25;i++)
	{

		cout<<fnum[i]<<'\t'<<fn[i]<<'\t'<<ln[i]<<'\t'<<lnum[i]<<endl;
	}
}

I need to make so the First Numbers and names display along with their last name counterparts in the functions
Files attached below

Files below

Your read loops are incorrect. There is a couple extra steps you have to take. The vectors are initially empty, so one way to do it is to append each string like this:

string ln;
for( int i= 0;i<25;i++)
{
    fin >> ln;
    fname.push_back(ln);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.