Другие языки программирования и технологии

Help C++

Help me in small C++ program

velocity = 331.3 + 0.61 * Tc

(velocity is meters/second)
(Tc temperature in Celsius)

Write a program that allows the user to input a starting and an ending temperature. Withing this temperature range, the program should output the temperature and the corresponding velocity in one-degree increments.
For example, if the user entered 0 as start temp and 2 as the end temp then the program should output:

At 0 degrees Celsius the velocity of sound is 331.3 m/s
At 1 degrees Celsius the velocity of sound is 331.9 m/s
At 2 degrees Celsius the velocity of sound is 332.5 m/s

Help plz =(
Добавлено 1 день назад
My version

#include <iostream>

using namespace stdl
int main()

{

int startt, endt, range, T;
double velocity;

cout << " Please enter starting temperature" \n ;
cin << startt ;
cout << " Please enter ending temperature" \n;
cin << endt;

range = endt - start;
velocity = 331.3 + 0.61 * T

Вот здесь у меня начинаются проблемы с Looping так как я не знаю как можно из целого числа ( range) на пример 10, сделать так чтобы можно было 10 раз повторить предложение

cout << "At " << range << "degrees Celsius the velocity of sound is" << velocity << "ms" ;

}
Добавлено 1 день назад
ya koe chto pridumal , no moget nemnogo blizko podhozhu k celi

#include <iostream>

using namespace stdl
int main()

{

int startt, endt, range, T;
double velocity;

cout << " Please enter starting temperature" \n ;
cin << startt ;
cout << " Please enter ending temperature" \n;
cin << endt;

range = endt - start;
velocity = 331.3 + 0.61 * T

while (range <= endt)
{

cout << "At " << range << "degrees Celsius the velocity of sound is" << velocity << "ms" ;

range = range + 1;

}

return 0;

}
Добавлено 1 день назад
===================================================================

NO , vot do six por mne ne yasno, kak sdelat chtoby "T" nachinalos naprimer s 0 i do 10
kazhdiy raz

At 0 degrees Celsius the velocity of sound is 331.3 m/s
At 1 degrees Celsius the velocity of sound is 331.3 m/s
At 2 degrees Celsius the velocity of sound is 331.3 m/s
....
At 10 degrees Celsius the velocity of sound is 331.3 m/s
миллион ошибок, блин. Зачем здесь namespase? Вот рабочаяя версия:

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int startt, endt;
double velocity;

std::cout << " Please enter starting temperature \n"<<endl;>> startt ;
std::cout << " Please enter ending temperature \n"<<endl;>> endt;

for (;startt <= endt;startt++)
{
velocity = 331.3 + 0.61 * startt;
std::cout << "At " << startt << " degrees Celsius the velocity of sound is " << velocity << " ms" <
Ф.
Фарик .
3 164
Лучший ответ
Нужно всего лишь перед
while (range <= endt)

написать range =start;
Получится:
range =start;
while (range <= endt)
{
velocity = 331.3 + 0.61 * range;
cout << "At " << range << "degrees Celsius the velocity of sound is" << velocity << "ms" ;
range=range+1;
}
Павел Павлович
Павел Павлович
35 996
сорри бро, не осилил
OMG!!!
Не люблю эту аббревиатуру, но здесь действительно ОМГ!
Ничего не знаем про инициализацию переменных.. . Да и вопрос ужасно оформлен, глаз сломаешь пока что-нить поймёшь.. .
Зачем вообще Вам писать на C++?.Специально для таких как Вы был когда-то давно создан Turbo Pascal, а сейчас есть и Free Pascal!
В общем, я так и ничего не понял, но если есть желание, можете написать ко мне в личку.. .
Хотя есть подозрение, что вы хотите чтобы первая строчка в функции int main() была не такой

int startt, endt, range, T;

а такой

int startt, endt, range, T = 8756;