If this is on personal opinion, I would say the initial creation of the telephone. Even though a smartphone practically kickstarted a whole era to technology that is still going on till this day, it was the telephone that started this all. If it wasn’t for the idea to create a phone that is more advanced than a box attached to the wall, none of these advancements would’ve happened at all. (Although that is uncertain, things do tend to have a way of working out in the end. If someone didn’t invent it, another person would’ve thought of it sooner or later.) But that is only if we’re talking long term, which I prefer because there was no limit to when the results of impact started in the prompt stated above, yet if we were to speak short term and the faster one, the credit would go to the smart cellphone. But we aren’t, because the question never specified ;)
Answer:
# include <iostream.h>
# include <stdio.h>
# include <string.h>
using namespace std;
class citizen
{
int i;
public string name[30];
public long int phonenumber[30];
public void addindividual(string name1)
{
If (i<=30)
{ int flag=0;
for(int j=0; j<=i;j++)
{
if (strcmp(name[i], name1)
{
flag=1;
}
else
{
flag=0;
}
}
If (flag)
{
if (i<30)
{
for(j=i+1;j<=30; j++)
{
cout<<"Enter the name:"; getchar(name[j]);
cout<<"Enter the phone number:"; cin>>phonenumber[j];
i++;
}
else
{
cout<<"The person already exists";
exit();
}
}
else
{
cout<<"array is full:";
exit();
}
}
}
Void main()
{
string str;
cout<<" Enter name:";
getline(cin, str); ;
citizen c1=new citizen();
c1.addindividual(name1);
}
Explanation:
With a little more effort you can make the program allow the user to enter any number of details, but less than 30 overall. We have used here flag, and as a programmer we know why we use the Flag. It is used to check whether certain Boolean condition is fulfilled or not. Here, we are checking whether a given name is present in the array of names, and if it is not present, we add that to the list. And if the name is present, we print, it already exist.
True anything is available online.