Alright guys,
I've been looking at this on google and I can't seem to find an answer. Any help is definitely appreciated!
Here is the code, then I will explain my problem.
void printMenu()
{
cout<<"||============================||"<<endl;
cout<<"||=========Main Menu==========||"<<endl;
cout<<"||===1.Begin DNA Creation";
cout<<"||===2.Load the Files";
if(!dna1[].strand1){
cout<<"<0>";}
else{
cout<<"<"<<sizeof(dna1.strand1)<<">";}
cout<<endl;
cout<<"=========||"<<endl;
cout<<"||===3.Save the Files=========||"<<endl;
cout<<"||===4.Exit===================||"<<endl;
cout<<"||============================||"<<endl;
cout<<"||===Enter a Choice <1-4>: ";
}
Now I'm assuming that my variable dna1 in the structure I created "dna" would behave like any other array and I won't need to pass it over. If this is incorrect then thanks for the heads up.
Basically this function is supposed to print the menu and it will check if the user has ran the function to create the array. If they havent, meaning they just started it up, The desired output is this:
||==============================||
||=========Main Menu============||
||===1.Begin DNA Creation=======||
||===2.Load the DNA Strand<0>===||
||===3.Save the DNA Strand======||
||===4.Exit=====================||
||==============================||
||===Enter a Choice <1-4>:
And if the first function (option 1) has been run then I would like it to print out the size of it.
Is it not possible to get the size of an array or even check to see if it's initialized?
I know
sizeof(int);
would run fine and print out 4.
Is there a way to get this to work? If anymore info is needed than let me know; I tried to include everything I thought was needed.