X Xyrrk Eternal Poster Established Joined Oct 8, 2017 Posts 687 Solutions 2 Reaction 216 Points 405 Feb 23, 2022 #1 Pa help po kung paano mag base yung array ko sa input ng user if he/she input 1000 dapat yung array ku is 1000. Tyia Attachments You do not have permission to view the full content of this post. Log in or register now.
Pa help po kung paano mag base yung array ko sa input ng user if he/she input 1000 dapat yung array ku is 1000. Tyia
B blademp119 Grasshopper Feb 23, 2022 #2 So ang idea jan is kunin mo ung input value dun sa "Estimated Number" and make sure that it is an integer type. Then on declaring other variables you use that value. Example: C++: int x; cout << "Estimated Number of residents: "; // Type a number and press enter cin >> x; // Get user input from the keyboard Then use that variable while declaring other arrays: C++: string name[x], age[x]; int i; cout<<"Name"; for(i=0; i<x; i++) cin>>name[i]; cout<<"\n Age:"; cin>>age[i]; .......
So ang idea jan is kunin mo ung input value dun sa "Estimated Number" and make sure that it is an integer type. Then on declaring other variables you use that value. Example: C++: int x; cout << "Estimated Number of residents: "; // Type a number and press enter cin >> x; // Get user input from the keyboard Then use that variable while declaring other arrays: C++: string name[x], age[x]; int i; cout<<"Name"; for(i=0; i<x; i++) cin>>name[i]; cout<<"\n Age:"; cin>>age[i]; .......