![]() |
Здравствуйте, гость ( Вход | Регистрация )
![]() |
![]() ![]()
Сообщение
#1
|
|
![]() Продвинутый пользователь ![]() ![]() ![]() Группа: Posters Сообщений: 220 Регистрация: 17.8.2007 Из: Чебы Пользователь №: 8,614 ![]() |
задание : f=(m*tg(t)+|c*sin(t)|)^1/3
Помогите плиз чо в этой программе не так ? (после компиляции и выполнения, результат f=1 при любых значениях t) #include <stdlib.h> #include <iostream.h> #include <math.h> #include <conio.h> #pragma argsused int main(int argc, char* argv[]) {const double m=2.0,c=-1.0; double t,f; cout<<"Vvedite t "; cin>>t; f=pow(m*tan(t)+abs(c*sin(t)),(1/3)); cout<<"f ravno "<<f; getch(); } -------------------- В голове один мотив - ЧЕМПИОН ЛОКОМОТИВ
|
|
|
![]() |
![]()
Сообщение
#2
|
|
![]() Мега постер ![]() Группа: Local moder Сообщений: 1,712 Регистрация: 21.8.2006 Пользователь №: 1,269 ![]() |
Может и не совсем удачное. Первое, что в голову пришло.
Код #include <stdio.h>
#include <string> #include <map> int main() { std::string in_str("Hello, world!"), out_str; std::map<char, unsigned int> ch_map; printf("Input string - %s\n", in_str.c_str()); for(unsigned int i = 0; i < in_str.length(); i++) if(ch_map.find(in_str[i]) == ch_map.end()) ch_map[in_str[i]] = 1; else ch_map[in_str[i]]++; for(unsigned int i = 0; i < in_str.length(); i++) if(ch_map[in_str[i]] != 3) out_str += in_str[i]; printf("Output string - %s\n", out_str.c_str()); return 0; } -------------------- |
|
|
![]() ![]() |
![]() |
Текстовая версия | Сейчас: 21st June 2025 - 00:24 |