From b8c1134ac2553f90e9f7bcdd2411bbac686cb48f Mon Sep 17 00:00:00 2001 From: Bartal Laearsson Date: Fri, 2 Oct 2026 12:03:40 +0100 Subject: [PATCH] pseudo code for temperature converter task --- .../src/main.rs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/common-programming-concepts-temp-converter/src/main.rs b/common-programming-concepts-temp-converter/src/main.rs index e7a11a9..5736e86 100644 --- a/common-programming-concepts-temp-converter/src/main.rs +++ b/common-programming-concepts-temp-converter/src/main.rs @@ -1,3 +1,27 @@ fn main() { - println!("Hello, world!"); + println!("Welcome to the temperature converter program!"); + + // TODO USER INPUT 1: FAHRENHEIT OR CELCIUS + // First we need to get an input from the user. In this case, I think it is best to like choose + // a number, because what text should they write? f to c? or fc? or only f? that gets + // confusing. Give them text like: to convert from celcius to fahrenheit, press 1. linebreak. to + // convert from fahrenheit to celcius, press 2. + // If they select any other number than 1 or 2, then try again. + // use the chooice later in a control flow. if this, then celcius, else fahrenheit or something + // like that + + // then the input should be sanitized and validated / parsed int. + + // TODO USER INPUT 2 + // next up, we need to get a new user input, as float. This must also be sanitized and parsed. + // Here we can perhaps come into some difficulties, what if the user inputs 22? not 22.0? also, + // we need to let the user input again, if the input is invalid, like text or whatever. + + // TODO CALCULATOR + // The control flow starts here. if user input 1 = 1 then convert from c to f. if user input = + // 2, then f to c. We could have a else to catch something unexpected. Say something like, an + // error occured when trying to convert temperature, please try again... + + // PRINT RESULT AND LOOP + }