Answer to Question #235182 in C++ for Aswini

Question #235182

PS: Imagine you are the salesperson in the supermarket and arranging the apples based on their size (in kgms) every day. One fine day, you decided to scan all the apples size and arrange it in less time than ever before. The scanner measured the apple’s size, for example, Apple 1 = 1.4 kgms and 1 kgms, Apple 2 = 1.8 kgms and 2 kgms. This made you arrange two patterns: Pattern 1 – apple size measured in float, Pattern 2 – apple size measured in integer. Design a C++ program to implement this given use case?

1
Expert's answer
2021-09-09T07:38:29-0400
#include<iostream>
using namespace std;
int main(){
int number;
cout<<"Enter the number of apples\n";
cin>>number;	


float pattern_1[number];
int  pattern_2[number];
cout<<"Enter the apples' sizes \n";
for(int i = 0; i<number; i++){
	cout<<"Apple  "<<(i+1);
	cout<<"\nSize in float\n";
	cin>>pattern_1[i];
	cout<<"\nSize in integer\n";
	cin>>pattern_2[i];
	
	
}
cout<<"The apples' sizes are as below\n";
cout<<"Apple  "<<"   Size in float     "<<"     Size in integer\n";
for(int i=0; i<number; i++){
	cout<<(i+1)<<"\t\t"<<pattern_1[i]<<" kgms\t\t"<<pattern_2[i]<<" kgms"<<endl;
	
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS