Hi, im having troubles with my scoreboard, i should input names and racetimes for each name, and it should rearenge it from best to last. But this dont work, please help me
scanf("%s\n",&name[i]);scanf won't take a std::string as an argument.
use cin.(and include iostream)
C stream fuctions and std::string don't mix very well.Use c++ streams (cout , cin)
for instance , do this:
1 2 3 4
std::string a[10];
std::cin >> a[0];//input a word
std::getline(cin,a[1]);//input a line
std::cout << a[0] << a[1] <<std::endl;
juzernejm wrote:
1 2 3 4 5
#include <conio.h>
...
void main()
...
getch();
Please don't use conio.h and getch().They are not standard and are non-portable.
Please don't use void main,The standard usage is : int main() , or int main(int argc,char* argv[])
Do not use C I/O with C++ classes.
If you need several parallel arrays, use single array and struct instead.
Do not reinvent the wheel. conio.h was deprecated in the previous century. Do not use it. void main() is illegal in C++
Declare variables just before you would use them and limit their scope.