Roshan
Bye guys!
Xudoyberdi
Bye guys!
Why😕
Roshan
Why😕
It's afternoon I've to do some work
Junaid
here is the code amir
Junaid
#include<stdio.h> #include<math.h> int main() { double p=1000.0,r=.05,n=1,amount; for(n=1;n<=10;n++) { amount=p*pow((1.0+r),n); printf("year %.2lf amount %.2lf\n",n,amount); int a=amount; printf("amount in dollar is %d \n",a); printf("amount in cents is %f \n",fmod( amount,a)); } return 0; }
John
Looking for a c++ guru
John
Assembly language guru too inbox me for a deal
Junaid
this will print dollars and cents seprately
Junaid
1000.555$ it will print 1000$ and .5555 cents
Junaid
the real logic starts from int a=amount
Roshan
1000.555$ it will print 1000$ and .5555 cents
#include<iostream> using namespace std; int main() { float a = 5.76; int b = a; float c = a - b; cout << b << " dollars and "<<c<<" dollars."; }
Roshan
Now stop this discussion
Roshan
Ok
Roshan
I'm out bye
Xudoyberdi
It's afternoon I've to do some work
Oh better, I thought you were leaving the group altogether🙄
Junaid
for example my number is 254.92 i want to print 254 in one variable and print 0.92 as an integer like 92 in other variable
#include<stdio.h> #include<math.h> int main() { float amount; printf("enter the amount"); scanf("%f",&amount); int a=amount; printf("before point %d \n",a); printf("after point is %f \n",fmod( amount,a)); return 0; }
Xudoyberdi
😁 Time has not come for that...
What, and do you speak English?😁
RC
#include <stdio.h> #include <stdlib.h> int main() { int integer1; int integer2; int sum; printf("enter first integer\n"); scanf("%d",integer1); printf("enter second integer\n"); scanf("%d",integer2); sum=integer1+integer2; printf("sum is %d\n",sum); return 0; }
Xudoyberdi
Use address operator when asking for an input from the user
Xudoyberdi
Xudoyberdi
Wdym?
I didn't understand your sentence, time has time 🤔
Roshan
Ehh
Xudoyberdi
Ehh
Sorry😅
Roshan
Typo I meant time has not come for that
Roshan
I'll be leaving this group in a couple of months
Xudoyberdi
I'll be leaving this group in a couple of months
I'm gonna be sad and left alone😬
Roshan
I'm gonna be sad and left alone😬
Until then CppWithMeHommies 😂
Xudoyberdi
Lava
Can someone tell me project scope in c++ . Like other than making games on game engines like unity .
Lava
I wanted to make some good projects...
Abdullah
/get cppbookguide
Anonymous
https://github.com/ChrisChenHai/zircon
what is it ? kernel related embedded systems?
Junaid
/get cguide
Roshan
/notes
Junaid
#cbook
Suka
what is it ? kernel related embedded systems?
yups. google attempt for replacing linux with micro kernel for "the next android" cmiiw 59% coding in c++
labyrinth
I understand how hash map work in principles. Using a bucket array of certain size, one can calculate the index with a given key to access the position. However when it comes to implementation, what is the data type of the bucket? shall it be struct DictEntry{ void *key; long long val; struct DictEntry * enxt }?
labyrinth
Then, do we treat all the (first) element DictEntry*[size] (i.e. bucket array) be dummy dict entry?
labyrinth
let's say, DictEntry*[4]->next == nullptr, indicates that it is empty at index 4
Alex
let's say, DictEntry*[4]->next == nullptr, indicates that it is empty at index 4
no. you compare dictentry[4].key if not match then go dictentry[4]->next until next is null
labyrinth
because there must be something to exist at this part of memory right? if it is not a dummy, how do we know if there is a legit entry at this index?
labyrinth
DictEntry[4].key equals something, what if this thing is a key that we have never set before but now there is a operation to read the data with this key? is there a suggested default value for this key?
labyrinth
then isn't this a dummy entry where the value is never used ?
Alex
then isn't this a dummy entry where the value is never used ?
why never? one day you will set dictentry[4].key, it depends on hash function
Alex
initially all keys are null, then you set them adding new values
labyrinth
true, i was being stupid haha
labyrinth
then when having ht.setKeys(k, v); if there aren't one key match, do we have new and copy under the hood? like, ht[idx].key = new T(k); ?
labyrinth
k could be left or right value so it is better to do the copy?
Alex
then when having ht.setKeys(k, v); if there aren't one key match, do we have new and copy under the hood? like, ht[idx].key = new T(k); ?
first you should decide how to deal with hash collision: you can use next index or use linked list. read theory
Alex
Roshan
Depends upon your algorithm
Igor🇺🇦
std::string::find accepts start position too. You can use results from the first run to find the second occurrence
labyrinth
I came across skip list and LRU implementation.. in one of the interviews, i was asked about the problem of these data structures in data intensive application....
labyrinth
for example, if there are billions of key/entries, the data structure could easily deplete the memory
labyrinth
billions could be unrealistic, but 100 millions may occur
labyrinth
then for such data structures, there are numerous pointers, each of which account for 8 bytes
labyrinth
and i could not hit him with a good alternative.
Ludovic 'Archivist'
billions could be unrealistic, but 100 millions may occur
Billion entries is not unrealistic for some data structures like bloom filters, quotient filters...
Anonymous
I didn't understand a Question, can anyone help me?
Anonymous
Write a C++ Program that contains four user defined function(s): addition(), subtraction(), division(), multiplication(). Develop a calculator as follows: • In main() function: o A menu with choices addition, subtraction, division and multiplication must be displayed. o Get two numbers and a choice from user o Call the respective functions with user given number as parameter using switch statement o Print the result from addition (), subtraction (), division (), multiplication (). • In user defined functions: o Plus and minus function get two integer values and return integer. o Multiply and Divide functions get two integer values and return double.