Hi,
My partner and me are kind of new to c++ and we're working on a program that is rather hard(for our capabilities on c++). Our program is nearly finished and all we have to do is to allow our program to accept some data. The problem is that we want the user to be able to name his/her own structs as it will store their personal data/ students' data, but we don't know how

. We also want the program to store the user defined names of the structs within another one that would allow data storage for each one of those names.
The closest thing we could actually get to solving my problem was a block of code that asked for number of names and names and stored them in a char array(which didn't really work as the user would then actually have to count all the letters of the names that he/her would want to put in

)
Anyway, here's the code if you want to look at it:
// Cesis2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
char g_NewUser[15];
char g_NewPassword1[20];
int g_x=0;
int g_hi=0;
int g_show=0;
int g_y=0;
struct g_Personalinfo
{
char firstname[10];
char lastname[15];
int age;
char school[30];
char subject[30];
int grade;
};
struct g_student
{
char firstname[10];
char lastname[15];
int age;
char school[30];
int grade;
};
int main()
{
using namespace std;
g_Personalinfo name;
menu:
cout<<"Welcome to Cesis!!!"<<endl;
cout<<"What Will You Like To Do?"<<endl;
cout<<"1)Login"<<endl;
cout<<"2)New User"<<endl;
cout<<"3)Exit"<<endl;
int menu;
cin>>menu;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
switch (menu)
{
case 1:
cout<<"Username:"<<endl;
char username[15];
cin>>username;
cout<<"Password:"<<endl;
char password[20];
cin>>password;
g_x=0;
g_show=1;
g_hi=1;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
goto accountinfo;
break;
case 2:
cout<<"Username:"<<endl;
cin>>g_NewUser;
cout<<"Password:"<<endl;
cin>>g_NewPassword1;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
goto newuser;
break;
case 3:
cin.get();
break;
default:
cout<<"Error Error!!! \a \a"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
goto menu;
break;
}
newuser:
int newuser1;
g_x=1;
cout<< "Username and Password Comfirmed"<<endl;
cout<< "Choose Where To Go"<<endl;
cout<< "1) Put Account In FO SHO"<< endl;
cout<< "2} Loga Outa (that meens log out in gansta talk)"<< endl;
cin>> newuser1;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
switch (newuser1)
{
case 1:
cout<<"Going to Account In FO SHO"<< endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
goto accountinfo;
break;
case 2:
goto menu;
break;
default:
goto menu;
break;
}
personalinfochange2:
int la;
int a=0;
int b=0;
int c=0;
int d=0;
int e=0;
int f=0;
if (g_y==0)
{
int w;
cout<<"Please Type In Your First Name:";
cin>>name.firstname;
cout<<"Please Type In Your Last Name:";
cin>>name.lastname;
cout<<"Please Type In Your Age:";
cin>>name.age;
cout<<"Please Type In Your School's Name:";
cin>>name.school;
cout<<"Please Type In Your Profession's Subject (If You Have More Then One Then One Subject, Type A Comma After Each One:";
cin>>name.subject;
cout<<"Please Type In Your Profession's Grade Level:";
cin>>name.grade;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
g_y=1;
goto switchy;
}
else
{
cout<<"What Information Would You Like To Change?"<<endl;
cout<<"1. First Name:"<<name.firstname<<endl;
cout<<"2. Last Name:"<<name.lastname<<endl;
cout<<"3. Age:"<<name.age<<endl;
cout<<"4. School:"<<name.school<<endl;
cout<<"5. Profession's Subject(s):"<<name.subject<<endl;
cout<<"6. Profession's Grade Level:"<<name.grade<<endl;
cin>>la;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
switch(la)
{
case 1:
cout<<"Changeing Information to:";
cin>>name.firstname;
cout<<"Is This the Correct Information?"<<endl;
cout<<"First Name:"<<name.firstname<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>a;
switch(a)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
break;
case 2:
cout<<"Changeing Information to:";
cin>>name.lastname;
cout<<"Is This the Correct Information?"<<endl;
cout<<"Last Name:"<<name.lastname<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>b;
switch(b)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
break;
case 3:
cout<<"Changeing Information to:";
cin>>name.age;
cout<<"Is This the Correct Information?"<<endl;
cout<<"Age:"<<name.age<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>c;
switch(c)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
break;
case 4:
cout<<"Changeing Information to:";
cin>>name.school;
cout<<"Is This the Correct Information?"<<endl;
cout<<"School:"<<name.school<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>d;
switch(d)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
break;
case 5:
cout<<"Changeing Information to:";
cin>>name.subject;
cout<<"Is This the Correct Information?"<<endl;
cout<<"Profession's Subject:"<<name.subject<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>e;
switch(e)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
break;
case 6:
cout<<"Changeing Information to:";
cin>>name.grade;
cout<<"Is This the Correct Information?"<<endl;
cout<<"Profession's Grade:"<<name.grade<<endl;
cout<<"1)Yes Or 2)No?"<<endl;
cin>>f;
switch(f)
{
case 1:
cout<<"Thank You... Returning Back to Acount Info"<<endl;
goto accountinfo;
break;
case 2:
cout<<"Please Retry Again..."<<endl;
cout<<"Going Back To Account Info Change Menu"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange2;
break;
}
}
switchy:
int w;
cout<< "Here is the Info You Put In."<< endl << "First Name:" << name.firstname << endl << "Last Name:" << name.lastname << endl << "Age:" << name.age << endl << "School's Name:" << name.school << endl << "Subjects:" << name.subject << endl << "Grade:" << name.grade << endl;
cout<< "Is The Info Correct?"<<endl;
cout<< "1)Yes or 2)No"<<endl;
cin>>w;
switch(w)
{
case 1:
cout<<"Going Back to AccountInfo"<<endl;
g_hi=1;
g_show=1;
goto accountinfo;
break;
g_y=1;
case 2:
cout<<"Please Re-Type Everthing:"<<endl;
goto personalinfochange2;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto switchy;
break;
}
accountinfo:
if (g_x==1)
{
int y;
cout<<"Welcome New User! I would like to know more about you to increase our knowledge.";
cout<<"Please go to New Info and type in your info. We would appriciate it if you told us the right infomation about you."<<endl;
cout<<"What do you want to do?"<<endl;
cout<<"1.Put in new info"<<endl;
cout<<"2.Go to account menu"<<endl;
cout<<"3.Go to main menu"<<endl;
cout<<"4.Log out"<<endl;
cin>>y;
switch (y)
{
case 1:
g_x=0;
goto personalinfochange;
break;
case 2:
g_x=0;
goto accountinfo;
break;
case 3:
g_x=0;
goto menu;
break;
case 4:
cin.get();
g_x=0;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto accountinfo;
break;
}
}
else
{ goto show1;}
show1:
if(g_show==1)
{
int z;
cout<<""<<endl;
cout<<"Welcome Back... What do you want to do?"<<endl;
cout<<"1)Change Account Info"<<endl;
cout<<"2)Go To Student Info"<<endl;
cout<<"3)Show Information About Yourself"<<endl;
cout<<"4)Log Out"<<endl;
cin>>z;
switch (z)
{
case 1:
goto personalinfochange;
break;
case 2:
goto studentinfo;
break;
case 3:
goto switchy;
break;
case 4:
cout<<"Logging Out";
goto menu;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto accountinfo;
break;
}
}
else
{
int z;
cout<<"Welcome Back... What do you want to do?"<<endl;
cout<<"1)Change Account Info"<<endl;
cout<<"2)Go To Student Info"<<endl;
cout<<"3)Log Out"<<endl;
cin>>z;
switch (z)
{
case 1:
goto personalinfochange;
break;
case 2:
goto studentinfo;
break;
case 3:
cout<<"Logging Out";
goto menu;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto accountinfo;
break;
}
}
personalinfochange:
int ppedpdsa;
cout<<"Want to Change Your Personnal Info?"<<endl;
cout<<"Please type in 1(Yes) or 2(No)"<<endl;
cin>> ppedpdsa;
switch (ppedpdsa)
{
case 1:
goto personalinfochange2;
break;
case 2:
cout<<"Going Back To Account Menu"<<endl;
goto accountinfo;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto personalinfochange;
break;
}
studentinfo:
int LALALAL;
cout<<"Welcome To Your Students Information"<<endl;
cout<<"If You're New, We Recommend Making New Students, Then Making A New Class"<<endl;
cout<<""<<endl;
cout<<"What Will You Like to Do?"<<endl;
cout<<"1)View All Your Classes"<<endl;
cout<<"2)Make A New Class"<<endl;
cout<<"3)Make A New Student";
cin>>LALALAL;
switch (LALALAL)
{
case 1:
cout<<"Going To Classes"<<endl;
break;
case 2:
break;
case 3:
goto createnewstudent;
break;
default:
cout<<"Error Error! \a \a "<<endl;
goto studentinfo;
break;
}
createnewstudent:
cout<<"How many students do you have?"<<endl;
int number;
cin>>number;
while (number>0)
{
cout<<"Name?"<<endl;
number--;
}
system("pause");
return 0;
} Thank You for helping us with our problems!!!

