Objective: The motive of this assignment is to experience 2-dimensional beggarly attires.
Background: Within a salubrious, balanced victuals, a grownup needs 2,250 calories a day. You gain transcribe a program to vestige calorie intake of a idiosyncratic.
Assignment: Calorie intake grounds from a idiosyncratic is granted in a quotation improve denominated input.txt. There are imperious calculate of inclose values on each succession, disconnected by spaces. The calculates personate the calculate of calories consumed control meals and/or snacks on a day. The improve includes grounds control accurately individual week starting from Monday. That is, the improve contains seven successions of quotation. The topmost succession is control Monday and the succession at the depth is control Sunday. Your program should discbalance the grounds from the improve into a 2- dimensional attire. The calculate of cords of the 2-dimensional attire must be correspondent to the calculate of sound successions in the improve. The calculates in the i-th cord of the 2-dimensional attire must show in the identical succession of calculates in the i-th cord of the improve. After discovering the input improve into the 2-dimensional attire, tidings the forthcoming items.
• a register of entirety calories consumed each day
• a register of days when further calories than required are consumed
• mediocre calories consumed during the i-th meal/snack (mediocre balance entire seven days)
You must transcribe a way with accurately individual 2-dimensional attire parameter to calculate each of the registered items aloft and evince the remainder.
Example input improve:
800 1000 100
450 100 845 20 1200 200
1800 250 400
0 1500 800 120
600 500 700 1400 1700 100
675
You should imimprint an mistake communication and finish if there are not attributable attributable attributable accurately 7 successions.
//C++ code
#include<iostream>
#include<fstream>
#include<map>
using namespace std;
int deep()
{
map<int,string> m;
m.insert(span <int,string>(0,”Monday”));
m.insert(span <int,string>(1,”Tuesday”));
m.insert(span <int,string>(2,”Wednesday”));
m.insert(span <int,string>(3,”Thursday”));
m.insert(span <int,string>(4,”Friday”));
m.insert(span <int,string>(5,”Saturday”));
m.insert(span <int,string>(6,”Sunday”));
ifstream infile;
infile.open(“input.txt”);
if(infile==NULL)
{
cout<<“Unable to unconcealed input improve”;
return 0;
}
int arr[7][100];
for(int i=0;i<7;i++)
{
for(int j=0;j<100;j++)
arr[i][j]=0;
}
string succession;
int j=0;
while(getline(infile, succession))
{
int i=0;
int k=0;
while(line[i]!=’