-
May 15th, 2017, 03:39 PM
#1
loop store of data
hello . I have a question on 2d arrays and loop Is there anyone to help. thx . Anyone??
Last edited by cooka; May 15th, 2017 at 03:45 PM.
-
May 15th, 2017, 04:05 PM
#2
Re: loop store of data
Well if you posted a c++ question it would help in obtaining a reply......
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 15th, 2017, 04:12 PM
#3
Re: loop store of data
Hi can anyone tell me plz how to display this part to work with void instead of ostream& . thx
Code:
ostream& DisplayMenu()
{
return (cout <<"Please choose from the following options :\n\n"
<<"1-I'm faculty ,staff or principal.\n"
<<"2-I'm a student.\n"
<<"3-I'm a visitor.\n\n"
<<"Or I want to see first :\n"
<<"------------------------\n\n"
<<"4-The total number of parked cars at a specific hour.\n"
<<"5-The number of parked car in each parking.\n"
<<"6-The total parking slots avaible.\n"
<<"7-A table view of the 3 parking area.\n"
<<"8-The total number of rejected parking request.\n\n"
<<"Or :\n"
<<"----\n\n"
<<"9-I changed my mind and would like to exit.\n\n");
}
int ChooseFromMenu()
{
int A = 0;
while ((DisplayMenu() && !(cin >> A)) || (cin.good() && (A < 1 || A > 9))) {
cout << "\nInvalid input!\n"<<endl;
cin.clear();
cin.ignore(1000, '\n');
}
return A;
}
Last edited by cooka; May 16th, 2017 at 04:06 AM.
-
May 16th, 2017, 04:07 AM
#4
Re: loop store of data
As the code stands, once the user chooses option 9 then the program will exit and all data stored in the arrays will be 'lost'. If you want the data stored in the arrays to be available between uses of the program then the data will need to be stored in a file before the program closes and then read from the file before it is used again in the program.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 16th, 2017, 04:09 AM
#5
Re: loop store of data
Sorry but I actually wanted first to modify that menu ?? can u do it for me in post #3 ?? I will repost the hole prog again later so we discuss the prob of storage because with void it could be much easier . thx
Last edited by cooka; May 16th, 2017 at 04:12 AM.
-
May 16th, 2017, 04:13 AM
#6
Re: loop store of data
Originally Posted by cooka
Sorry but I actually wanted first to modify that menu ?? can u do it for me in post #3 ?? I will repost the hole prog again later so we discuss the prob of storage thx
You're modified your post again so that as it stands it asks a completely different question to what it did and to what was answered in post #4.
This is now closed.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|