Hi guys,
i've a problem. I don't know how to use atof or atoi in a bidimensional array.
Basically i need lo make a list with names and family name, with three notes.
Like:
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
int fila, columna;
int matriz[10][10];
cout<<"Ingrese el numero de filas: ";
cin>>fila;
cout<<"Ingrese el numero de columnas: ";
cin>>columna;
//Ingreso de valores
for(int i=0; i<fila; i++){
for (int n=0; n<columna; n++)
{
cout<<"Ingrese el valor de ["<<i<<"]["<<n<<"]: ";
cin>>matriz[i][n];
}
}
//Muestra la matriz
cout<<"Matriz hecha: "<<endl;
for (int i=0; i<fila; i++){
for(int n=0; n<columna; n++)
{cout<<matriz[i][n]<<" ";
}
cout<<endl;
}
}
If you want something like this: Julia Anderson 3.2 3.8 4.3, i assume you there are five pieces of information, first-name, last-name and then three floating-point numbers.
That would seem to fit a structure like this:
Well, I'm still not entirely sure what it is you are supposed to do. Please be patient with me as I'm feeling a bit lost here.
If you use an array, all the items must be of the same type - that is, all are strings, or all are integers. If you want to preserve all of the information, then using string for everything would seem most suitable. If you use int for everything you won't be able to store any names.
Unless of course used two completely separate arrays, one for the text, the other for the numbers.