Dear Members
I have started the following program, and I do not know how to solve the issue to store names in an array and retrieve them again, and how tos tore the names in a file in the Hard drive. If somebody could help me with my issue. Thanks so much
Ahmed.

Source Code

#include <iostream.h>
#include <string.h>
#include <ctype.h>
main()
{

	float grade[25][2]={0,0,0};//first grade, second grade
	char studentsname[25][13];//students' names
	char name;
	int num =0;
	int test;
	char yesorno = 'y';

for (int i=0; i<5 ; i++)
{
	cout<<"Enter name of student number "<<i+1<<'\n';
	cin>>studentsname[i][];
	
	
	for (int j=0; j<2; j++)
		{

	cout<<"Enter grade of test "<<j+1<<" for student "<<studentsname[i+1][13]<<" : "; 
	cin>>grade[i][j];
	cout<<'\n';
		}

}

while (yesorno =='y')
{


cout<<"Enter a student's name : ";
cin>>name;
for (i=0; i<25; i++)
{
	if (name == studentsname[i][13])
	{
		
cout<<"Which score woudl like to see 1 or 2 : ";
cin>>test;
cout<<'\n';

cout<<"student "<<name<<"] got "<<grade[num-1][13]<<" in test "<<test<<'\n';
cout<<"Would you like to continue : (y/n) ?\n";
cin>>yesorno ;
	}
	else 
		cout<<"This student is not among the class ";

}
}

return 0;
}

Ok...firstly, u really should learn about <fstream>
Declaration:

#include <fstream>

..
...

//in your main()

ofstream fout;
fout.open("NEW.txt");

fout<<name; //this goes after user inputs @ after you stored students' names into -> name
..
...
..
//once done, close the file
fout.close();

This is how to store something into an array:

for(int i=0;i<25;i++){
string name;
cout<<"Enter student's name: ";
cin>>name;
}

for(i=0;i<25;i++)
cout<<name;

These should work....The rest, is up to you

Tahnk you so much

This is how to store something into an array:

for(int i=0;i<25;i++){
string name;
cout<<"Enter student's name: ";
cin>>name;
}

for(i=0;i<25;i++)
cout<<name;

These should work....The rest, is up to you

This article has been dead for over six months. Start a new discussion instead.