how to make the getline(cin>>was,full name) function to show when I am trying to make it show in a for loop. Please show me an example. Please accept that I am not putting in the full code because my full code is too long struct user { String full_name[50]; int age } struct user *ptr=d for example: for(int I=0; I<5; I++) please disregard the fact that "I" is capitalized because autocorrect keeps changing it. { cout<<"please type in your name"<>was,d.full_name[i]); cout<< "enter age"> cin>>d.age[i]; } now I am supposed to print the name. for(int I=0; I<5;I++) { Cout<<"user "<
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
how to make the getline(cin>>was,full name) function to show when I am trying to make it show in a for loop. Please show me an example. Please accept that I am not putting in the full code because my full code is too long
struct user
{
String full_name[50];
int age
}
struct user
*ptr=d
for example:
for(int I=0; I<5; I++) please disregard the fact that "I" is capitalized because autocorrect keeps changing it.
{
cout<<"please type in your name"<<endless;
getline(cin>>was,d.full_name[i]);
cout<< "enter age">
cin>>d.age[i];
}
now I am supposed to print the name.
for(int I=0; I<5;I++)
{
Cout<<"user "<<d.full_name<<"is " <<age endl;
}
so the age shows up but the name won't show up because of getline. I am away from my computer and typed this manually so please show me a tip and don't deny this question because my full code is longer than 5,000 and I just need the tip to get the name to print in a for loop in structure array
Step by step
Solved in 4 steps with 2 images