Char and String together?

Write your question here.
Can you use both char and string data types to a specific variable?
1
2
3
4
5
6
7
8
9
10
11
12
13
//example code
#include <iostream>
#include <cstring>
using namespace std;
main()
{ 
      char str1[10];
      cout<<"Enter phrase/word: ";
      cin.getline(str1, 10);
      cout<<endl;
      cout<<"There are " << strlen(str1) << " character(s) in this string."<<endl;
      system("pause");
}


The data type of str1 is [char], if I want to add [string] as a data type to it, what is the most basic and simplest way to do it?
Topic archived. No new replies allowed.