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 268 views
1 answer 278 views
1 answer 263 views
1 answer 365 views
1 answer 231 views
1 answer 254 views
1 answer 284 views
...