problem with for loops

I am trying to mpake a simple for-loop program that prints my name out 10 times, but I keep on getting loads of errors every time I compile it. Here's the code so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream> 
using namespace std; 
  
int main() 
{ 
  string name = 'Sarah'; 
  int i; 
  for (i = 0; i < 10; i++) 
  { 
    cout << name; 

  } // for 
  cout << endl; 
  
  return 0; 
} // main 
'Sarah' should be "Sarah".

The single apostrophe ' is used around a single char only.
Thanks, I did change that, but I still received this compilation error:

c2679 - binary 'operator' : no operator found which takes a right-hand operand of type 'type' (or there is no acceptable conversion)
#include <string> , perhaps.
Last edited on
Include header <string> in your program.
That worked! Thanks
Topic archived. No new replies allowed.