~riderius/cpp-code

0bf2491b4696cb545ff64a79ee71a6e66a08e1ee — RIDERIUS 9 months ago
delete tabs
M Celsius_to_Fahrenheit_converter.cpp => Celsius_to_Fahrenheit_converter.cpp +11 -11
@@ 5,18 5,18 @@ double converter(int celsius);

int main()
{
int celsius;
while (true)
{
cout << "PLease enter a celsius value: ";
cin >> celsius;
cout << celsius << " degrees Celsius is " << converter(celsius) << " degrees Fahrenheit." << endl;
}
return 0;
int celsius;
while (true)
{
cout << "PLease enter a celsius value: ";
cin >> celsius;
cout << celsius << " degrees Celsius is " << converter(celsius) << " degrees Fahrenheit." << endl;
}
return 0;
}

double converter(int celsius)
{
double Fahrenheit = celsius * 1.8 + 32;
return Fahrenheit;
}
\ No newline at end of file
double Fahrenheit = celsius * 1.8 + 32;
return Fahrenheit;
}

M Light_years_to_Astronomical_Units_Converter.cpp => Light_years_to_Astronomical_Units_Converter.cpp +5 -5
@@ 6,13 6,13 @@ double converter(double);

int main()
{
double light_years;
cout << "Enter the number of light years: ";
cin >> light_years;
cout << light_years << " light years = " << converter(light_years) << " astronomical units." << endl;
double light_years;
cout << "Enter the number of light years: ";
cin >> light_years;
cout << light_years << " light years = " << converter(light_years) << " astronomical units." << endl;

}
double converter(double light_years)
{
return light_years * 63240;
return light_years * 63240;
}

M digit_or_letter.cpp => digit_or_letter.cpp +2 -2
@@ 6,10 6,10 @@ int main(void) {
char symbol;
cin >> symbol;

if ('A' <= symbol && symbol <= 'z')
if ('A' <= symbol && symbol <= 'z')
cout << "Letter";
else if ('0' <= symbol && symbol <= '9')
cout << "Digit";
else
cout << "?";
cout << "?";
}

M reverse_int.cpp => reverse_int.cpp +1 -1
@@ 5,7 5,7 @@ int reverse(int n);
int main()
{
using namespace std;
int k;
cin >> k;
cout << reverse(k) << '\n';

M screensaver.cpp => screensaver.cpp +5 -5
@@ 5,11 5,11 @@
int main(void) {
setlocale(LC_ALL, "");
initscr();
start_color();

char str[COLS];
printw("Enter a string: ");
getstr(str);

@@ 44,14 44,14 @@ int main(void) {
y++;
if(x > COLS - strlen(str)) {
x = 0;
}
}
else if(y > LINES - 2) {
y = 0;
}

if(i == 12)
i = 0;
i = 0;

refresh();
char ch = getch();