What this program does is obvious. But there is a small problem: we don't need all the pairs (ex. 800x1200) and we could use less memory if we had made xy={800*600, 1024*768...}. But we want the program to print the values in a loop. Any idea to solve this problem?
Code:int main() { unsigned short x[] = {800, 1024, 1152,1600,2048}; unsigned short y[] = {600, 768, 864 ,1200, 1536}; unsigned short c[] = {2,4}; for(int cn=0; cn<2;cn++) for(int i=0; i<5; i++) cout<<x[i]<<"x"<<y[i]<<"x"<<c[cn]*8<<" = "<<(x[i]*y[i]*c[cn])/(1024*1024.0f)<<" MB(s)"<<endl; return 0; }