Mino
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main()
{
vector<float> t(10001);
float simTime=10.0;
float dt=0.001;
for(int i=0; i<10001; i++)
{
float value=i*dt;
t[i]=value;
cout<<t[i]<<endl;
}
vector<float> i_a(t.size());
i_a[0]=0.0;
double ka =3;
double kb=2;
double kc=1;
int check;
for (int i=0; i<10001;i++)
{
if (t[i]<0 || t[i]==0) {
check=1; }
else {
check=0;}
i_a[i+1]= i_a[i] + ( -(kb/ka)*i_a[i] + (kc/ka)*check)*dt;
cout<<i_a[i]<<endl;
}
return 0;
}
Alex
Mino
The code is ok, but I don't know because the value are wrong. The current should increase
Mino
The current has to reach 0.5
EMRE
write your question here
I want program to recursive mode the multiplication of the digit values of the number entered by the user.
Alex
EMRE
your question?
How can I transfer the place values of the number I wrote into the array?
Alex
use indexes of the array
Roshan
Suka
Anonymous
I am aware that there is no c# channel, but I could not find a channel to ask and ı wanted to get the opinions of those who know.
Is there a youtube channel for c# that you can recommend? And for oop.
Thanks..
Igor🇺🇦
Anonymous
Anonymous
Anonymous
Goh Yong
/get cbook
Goh Yong
may i ask that whether the admin is a real person or a bot , or both
olli
Muhammed Bedir
Can I overloading << operator for ofstream and ostream at the same time?
Vlad
Vlad
go figure
Muhammed Bedir
friend std::ostream& operator<<(std::ostream &sout, Hex &game);
friend std::ofstream& operator<<(std::ofstream &fout,const Hex &game);
Muhammed Bedir
std::ofstream file(fname);
file << this;
file.close();
Muhammed Bedir
Vs says << is ostream type
Vlad
Vlad
ostream is enough. Polymorphism, fren'
Muhammed Bedir
But declaration is different I mean output
Muhammed Bedir
std::cout << "OFSTEREAM " << std::endl;
fout << "Id: " << game.getId() << std::endl;
fout << "Size: " << game.getSize() << std::endl;
fout << "Type: " << game.getType() << std::endl;
fout << "Turn: " << game.getTurn() << std::endl;
fout << "Winner: " << game.getWinner() << std::endl;
fout << "Finish: " << game.getFinish() << std::endl;
for (int i = 0; i < game.getSize(); ++i)
{
for (int j = 0; j < game.getSize(); ++j)
{
if (game.hexCells[i][j].getCell() != celltype::empty)
fout << i << " " << j << " " << game.hexCells[i][j].getCell() << std::endl;
}
}
return fout;
Vlad
Btw is it safe to take an address of cout?
Muhammed Bedir
Vlad
No?
I dunno that's why I'm asking, lol
Muhammed Bedir
😂😂
Vlad
I know that taking an address of std:: functions is ub(unless specified otherwise)
olli
Roshan
Muhammed Bedir
I guess these cout and cin adress is not change until program done
Muhammed Bedir
Muhammed Bedir
Roshan
Is sout << "......\n"; not cout??
Vlad
Muhammed Bedir
It is ostream string to assaign cout
Vlad
Muhammed Bedir
I mean classic overload varible
Roshan
Muhammed Bedir
No it is not
Vlad
lmao im dying
Roshan
Vlad
Vlad
Rather the functions that are within std:: namespace
labyrinth
if i were to define a list constructor like this, how am i gonna make it?
labyrinth
https://en.cppreference.com/w/cpp/container/unordered_map/unordered_map
labyrinth
i dont see the word list constructor but initialisation list,
HaiNahi
Anyone willing to make a hobby project with me ?
Pavel
labyrinth
// list constructor
std::unordered_map<int, std::string> m2 =
{
{1, "foo"},
{3, "bar"},
{2, "baz"},
};
labyrinth
from cpp reference
labyrinth
in addition, i came across template<T> mystruct<T*> which i cannot understand
labyrinth
an example of this would be std::hash, where there are lot of variants for the basics type
Pavel
Because in case of the map, initializer_list can help to pass objects that will be stored in the container, but these will not affect type as far as I remember.
And pair and tuple are made with templates so their type depends on every element of the constructor
Roshan
int main(){
static int n = 1;
if(cout<<n<<" " && n++ < 10 && main()) {}
}
Roshan
Roshan
Can you do any better?
olli
Xudoyberdi
HaiNahi
Printf better I am in android my laptop out somewhere I have termux any idea for command line projects
Xudoyberdi
Xudoyberdi
I should learn more
HaiNahi
I am a high school student the last project I made is a chess engine
HaiNahi
I am also not pro
Xudoyberdi