Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Please help I am using code blocks so cant use conio library Please.docx

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Chargement dans…3
×

Consultez-les par la suite

1 sur 2 Publicité

Please help I am using code blocks so cant use conio library Please.docx

Télécharger pour lire hors ligne


Please help I am using code blocks so cant use conio library

Please help I am using code blocks so cant use conio library
Write a program that convert integer Fahrenheit temperature to Celsius or Celsius to Fahrenheit. Use floating points with 3-digit precision. Your program should 1- Prompt to CF or FC. Where CF converting Celsius to Fahrenheit and FC to convert for converting from Fahrenheit to Celsius. 2- Once you are ready to enter CF or FC, then Enter FC and then enter 5 testing values all at once and hit enter to give the final answers in two colmuns Column 1: Your entered values and Column 2: Your converted value. Repeat step a for CF a. b. Commands (paste text not picture Output (paste picture
Solution
#include <stdio.h>
#include <string.h>
int main(){
char choice[2];
double temperature[5];
int i;
while(1){
printf(\"Enter CF or FC: \");
scanf(\"%s\", choice);
if(strcmp(choice, \"CF\") != 0 && strcmp(choice, \"FC\") != 0) break;
printf(\"Enter 5 temperatures\ \");
for(i = 0; i < 5; i++){
scanf(\"%lf\", &temperature[i]);
}
if(strcmp(choice, \"CF\") == 0){
printf(\"Celsius\\tFahrenheit\ \");
}
else printf(\"Fahrenheit\\tCelsius\ \");
for(i = 0; i < 5; i++){
printf(\"%.3lf\\t\", temperature[i]);
if(strcmp(choice, \"CF\") == 0){
printf(\"%.3lf\ \", temperature[i] * 1.8 + 32);
}
else printf(\"%.3lf\ \", (temperature[i] - 32) / 1.8);
}
}
}
.


Please help I am using code blocks so cant use conio library

Please help I am using code blocks so cant use conio library
Write a program that convert integer Fahrenheit temperature to Celsius or Celsius to Fahrenheit. Use floating points with 3-digit precision. Your program should 1- Prompt to CF or FC. Where CF converting Celsius to Fahrenheit and FC to convert for converting from Fahrenheit to Celsius. 2- Once you are ready to enter CF or FC, then Enter FC and then enter 5 testing values all at once and hit enter to give the final answers in two colmuns Column 1: Your entered values and Column 2: Your converted value. Repeat step a for CF a. b. Commands (paste text not picture Output (paste picture
Solution
#include <stdio.h>
#include <string.h>
int main(){
char choice[2];
double temperature[5];
int i;
while(1){
printf(\"Enter CF or FC: \");
scanf(\"%s\", choice);
if(strcmp(choice, \"CF\") != 0 && strcmp(choice, \"FC\") != 0) break;
printf(\"Enter 5 temperatures\ \");
for(i = 0; i < 5; i++){
scanf(\"%lf\", &temperature[i]);
}
if(strcmp(choice, \"CF\") == 0){
printf(\"Celsius\\tFahrenheit\ \");
}
else printf(\"Fahrenheit\\tCelsius\ \");
for(i = 0; i < 5; i++){
printf(\"%.3lf\\t\", temperature[i]);
if(strcmp(choice, \"CF\") == 0){
printf(\"%.3lf\ \", temperature[i] * 1.8 + 32);
}
else printf(\"%.3lf\ \", (temperature[i] - 32) / 1.8);
}
}
}
.

Publicité
Publicité

Plus De Contenu Connexe

Similaire à Please help I am using code blocks so cant use conio library Please.docx (20)

Plus par ellenj4 (20)

Publicité

Plus récents (20)

Please help I am using code blocks so cant use conio library Please.docx

  1. 1. Please help I am using code blocks so cant use conio library Please help I am using code blocks so cant use conio library Write a program that convert integer Fahrenheit temperature to Celsius or Celsius to Fahrenheit. Use floating points with 3-digit precision. Your program should 1- Prompt to CF or FC. Where CF converting Celsius to Fahrenheit and FC to convert for converting from Fahrenheit to Celsius. 2- Once you are ready to enter CF or FC, then Enter FC and then enter 5 testing values all at once and hit enter to give the final answers in two colmuns Column 1: Your entered values and Column 2: Your converted value. Repeat step a for CF a. b. Commands (paste text not picture Output (paste picture Solution #include <stdio.h> #include <string.h> int main(){ char choice[2]; double temperature[5]; int i; while(1){ printf("Enter CF or FC: "); scanf("%s", choice); if(strcmp(choice, "CF") != 0 && strcmp(choice, "FC") != 0) break; printf("Enter 5 temperatures "); for(i = 0; i < 5; i++){ scanf("%lf", &temperature[i]); } if(strcmp(choice, "CF") == 0){ printf("CelsiustFahrenheit "); } else printf("FahrenheittCelsius "); for(i = 0; i < 5; i++){
  2. 2. printf("%.3lft", temperature[i]); if(strcmp(choice, "CF") == 0){ printf("%.3lf ", temperature[i] * 1.8 + 32); } else printf("%.3lf ", (temperature[i] - 32) / 1.8); } } }

×