Roshan
Bye guys!
Xudoyberdi
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
Anonymous
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
Junaid
Roshan
Ok
Roshan
I'm out bye
Roshan
Xudoyberdi
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;
}
RC
Xudoyberdi
Xudoyberdi
Use address operator when asking for an input from the user
RC
Roshan
Xudoyberdi
Xudoyberdi
Wdym?
I didn't understand your sentence, time has time
🤔
Roshan
Ehh
Xudoyberdi
Roshan
Typo I meant time has not come for that
Xudoyberdi
Roshan
I'll be leaving this group in a couple of months
Xudoyberdi
Roshan
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...
Alex
Anonymous
Suka
Abdullah
/get cppbookguide
Junaid
/get cguide
Roshan
/notes
Junaid
#cbook
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 }?
Alex
labyrinth
Then, do we treat all the (first) element DictEntry*[size] (i.e. bucket array) be dummy dict entry?
Alex
labyrinth
let's say, DictEntry*[4]->next == nullptr, indicates that it is empty at index 4
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?
Alex
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?
Alex
labyrinth
then isn't this a dummy entry where the value is never used ?
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
labyrinth
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
Ludovic 'Archivist'
labyrinth
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.
Anonymous
I didn't understand a Question, can anyone help me?
Roshan
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.