look at my code,
what is held in name[7]? a null? or random information?
for example,,,how would i get it to print letter by letter till it reachs the end of my name , rodrigo. ? without directly telling it to stop at name[6]?
Code:
#include <string>
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
string name("rodrigo");
cout << name[7];
getch();
}
i tried this to find out what name[7] was holding but prints nothing.
-
i have tried this but i have no idea what i was doing,, lol
Code:
#include <string>
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
string name("rodrigo");
for(int x=0; x!=NULL;x++){
cout << name[x];
endl;
}
getch();
}