How to declare a string stored inside a string variable to create a new variable in C++
#include<iostream>
using namespace std;
struct student
{
int roll_no;
string branch;
int grade;
};
int main()
{
string s;
cout <<"ENTER THE NAME OF THE STUDENT"<<endl;
cin>>s;
struct student s; //(HERE I WANT TO DECALRE THE NAME STORED INSIDE THE VARIABLE S)
return 0;
}
New contributor
Akarsh Maurya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4