Created
September 13, 2022 10:02
-
-
Save RahulBRB/2fa6a57180cffa85e7a2db3d48ec4a7d to your computer and use it in GitHub Desktop.
Code to fill 60 elements in an array, in such a way that first 20 elements are "Pizza", next 20 elements are "Burgers", and the last 20 elements are "Hotdog".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
int main(){ | |
const int SIZE = 60; | |
std::string foods[SIZE]; | |
fill(foods, foods + (SIZE/3), "Pizza"); | |
fill(foods+(SIZE/3), foods + (SIZE/2), "Burgers"); | |
fill(foods+(SIZE/2), foods + SIZE, "Hotdog"); | |
for(std::string list : foods){ | |
std::cout << list << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment