58.8k views
2 votes
Create a new program with a struct, Data, that contains: an int a char[80] Write a function newData(char[]), that takes char[] as a parameter

User Lateralaus
by
8.6k points

1 Answer

0 votes

Answer:

#include <iostream>

#include <cstring>

using namespace std;

struct Data {

int userId;

char name[80];

}

void newData(string data char[]){

int counts= 0;

struct Data name;

data.userId = ++counts;

data.name = char[];

cout<< data.userId << "\\"<< data.name ;

}

int main( ) {

char myName;

string mydata;

cin>> myName;

cin>> mydata;

newData( myName, mydata);

}

Step-by-step explanation:

The c++ source code above stores its data in a struct called "Data". The function newData dynamically creates new data from the struct defined.

User Ztsv
by
7.8k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.