Skip to content

Instantly share code, notes, and snippets.

@RahulBRB
Created September 13, 2022 10:02
Show Gist options
  • Save RahulBRB/2fa6a57180cffa85e7a2db3d48ec4a7d to your computer and use it in GitHub Desktop.
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".
#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