Ok I am trying to do a while statement and cannot figure out how to add the count to a name of an input =/ By looking at it you will get the just of what I am trying to accomplish.. Maybe one of yall can help me.
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
int main (){
const int SIZE = 81;
char runner, runner1, runner2, runner3;
double time, time1, time2, time3;
int count;
I have tried various different ways to no prevail =/ for example:
cin >> time(count);
cin >> time[count];
and others that I have forgotten by now. We are not getting into the do/while loops until another week or 2 in school but I figure it can be done kinda like html but just can't figure it out =/
This is just the begging of the code, in the end I want to take 3 runners names and times then display them in order from best time to last. I had it written the long way before but I know its a waste of typing doing every cout/cin for all 3 runners/times.. I am not asking for any code though for my project just how too add a count to my variable so it stores each new variable into memory so I can display them later. I tried looking with a search to no success =(
lol I was playing around with different things to the point of exhausting anything I could think of. I am trying to turn variable char runner into like runner1, runner2, runner3 and same for time (time1, time2, time3) till loop runs thru then able to display them later.. I prob have it all fugged up =(
just trying to figure out how to add my count to the end of my variables so I can recall and display them later I guess easiest way to say it
Okay, I think I understand what you mean.
You want to modify the name of 'runner' at run time so it becomes runner1, runner2, etc.
Yeah, that's not how things work.
Variable names are there only for your benefit. At run time they don't exist and there is no way of knowing what a variable was called at compile time.