" . • I #include using namespace std; int main() ( char letter; // Place to store input letter int tempIn; // Temperature to be converted int tempout; // Converted temperature cout Input Menu cout <<"F Convert from Fahrenheit to Celstus" e endl; cout<<"C Convert from Celstus to Fahrenhette endl; endte endl; //ADO CODE: Begin do-while loop here cout <<"Type a C or an F, then press return." << endl; cin letter; //REPLACE CODE: use a while loop instead of an Lf here It should loop until the user enters a valid letter if (letter - 'C' && Letter I-'c' && Letter Fletter - ¹) ( } cout << "Wrong letter. e endl; return 1; cout <<"Type an integer number, then press return." << endl; ctn tempIn; tr (letter - 'C' || letter - 'C') ( terpout (9 tempIn / 5) + 32; } else ( terpOut 5 (tempIn 32) / 9; } cout<<"Temperature to converti cout"Converted temperature: terpin endl; terpoute endl; //ADD CODE: ask user "Do you want to convert another temperature (y/n). return 0; //ADD CODE: end do-while loop here repeat loop if user typed a 'y'
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
can you please add in a code where needed?also this is a c++ code and please can you add professional comments // in it
Step by step
Solved in 3 steps