How to create temperature converter using array of structure c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to create temperature converter using array of structure c++

Can u guys show me the code. I'm having a hard time with this one

5th Jun 2022, 10:23 AM
Miguel
10 Answers
0
If you need help, please give a COMPLETE TASK DESCRIPTION. It is unclear what data should e converted to from which unit to which other unit. It is unclear what the array stores.
5th Jun 2022, 10:37 AM
Lisa
Lisa - avatar
0
If you want help, 👉 READ THE REPLIES COMPELTELY. ⭐⭐⭐⭐⭐ GIVE THE COMPLETE TASK DESCRIPTION ⭐⭐⭐⭐⭐
5th Jun 2022, 10:45 AM
Lisa
Lisa - avatar
0
From the given information it is unclear what the input looks like or if we have given data. It is unclear what purpose an array of structure serves here...
5th Jun 2022, 11:03 AM
Lisa
Lisa - avatar
0
Thats the only information given
5th Jun 2022, 11:07 AM
Miguel
0
Ill attach code sample
5th Jun 2022, 11:09 AM
Miguel
0
#include<iostream> #include<stdlib.h> #include<cstring> using namespace std; struct student { char name[20]; char coursec[15]; char subj[2][10]; int grade[2]; char graderemarks[2] [7]; }; struct student stud[3]; char remarks[2][7] = {"PASSED","FAILED"}; int i,j; int main() { for(i=0;i<=2;i++) { cout<<"STUDENT "<<i+1<<endl; cout<<"Name : "; cin.getline(stud[i].name,20); cout<<"Course/Section : "; cin.getline(stud[i].coursec,15); cout<<"Subject : \n"; for (j=0;j<=1;j++) { cout<<"("<<j+1<<") "; cin.getline(stud[i].subj[j],10); cout<<"Grade : "; cin>>stud[i].grade[j]; if (stud[i].grade[j]>=75) { strcpy(stud[i].graderemarks[j],remarks[0]); } else{ strcpy(stud[i].graderemarks[j],remarks[1]);
5th Jun 2022, 11:10 AM
Miguel
0
Second example
5th Jun 2022, 11:11 AM
Miguel
0
#include<iostream> #include<stdlib.h> #include<cstring> using namespace std; struct student { char name[20]; char coursec[15]; char subj[2][10]; int grade[2]; char graderemarks[2] [7]; }; struct student stud[3]; char remarks[2][7] = {"PASSED","FAILED"}; int i,j; int main() { for(i=0;i<=2;i++) { cout<<"STUDENT "<<i+1<<endl; cout<<"Name : "; cin.getline(stud[i].name,20); cout<<"Course/Section : "; cin.getline(stud[i].coursec,15); cout<<"Subject : \n"; for (j=0;j<=1;j++) { cout<<"("<<j+1<<") "; cin.getline(stud[i].subj[j],10); cout<<"Grade : "; cin>>stud[i].grade[j]; if (stud[i].grade[j]>=75) { strcpy(stud[i].graderemarks[j],remarks[0]); } else{ strcpy(stud[i].graderemarks[j],remarks[1]);
5th Jun 2022, 11:11 AM
Miguel
- 1
It should be converted into Fahrenheit, Kelvin and Celsuis
5th Jun 2022, 10:39 AM
Miguel
- 1
program using basic program structure ( sequential or selection) convert it utilizing array of structure
5th Jun 2022, 10:52 AM
Miguel