How to copy character from string to char variable in C++

1 Answer

0 votes
#include <iostream>

using namespace std; 
  
int main() 
{                       
    string s = "cPP pRograMMinG"; 
    
    char ch = s[4];
     
    cout << ch;
    
    return 0; 
} 
 
 
  
  
/*
run:
  
p
  
*/

 



answered Nov 12, 2019 by avibootz

Related questions

1 answer 176 views
1 answer 198 views
1 answer 180 views
1 answer 155 views
1 answer 159 views
1 answer 171 views
1 answer 181 views
...