C++ :: Using List To Implement Huge Numbers?
Nov 22, 2013
Im trying to implement a way to use really big numbers to be able to add, substract and multiply them with the class I made. for example:
huge a = "45646464646455464654656"
huge b = "456464564646544646"
huge c = a+b;
[Code]....
View 13 Replies
ADVERTISEMENT
Jan 5, 2014
Not inheriting properly and provide the corrected code if possible
Code:
#include <iostream>
using namespace std;
class Node {
protected:
int Data;
[Code] ....
View 4 Replies
View Related
Feb 7, 2013
I am trying to implement 2-D Linked Lists using classes. My program works fine for 1-D Linked List but I am having trouble understanding the syntax for using 2-D Linked Lists.
View 3 Replies
View Related
Jun 15, 2013
Well, basically, what I've been doing was creating a class that would implement the concept of Double Linked List, but that would behave like a queue ( the STL implementation is deque, or Double Ended Queue ).
The problem occured when I have been trying to generalize the class using templates. I mean, why use only integers ? Why not double or char or what not ?
Worked perfectly before including all the template stuff..
// Source.cpp <=> Main.cpp
#include <iostream>
#include "DList.h"
using namespace std;
int main(void) {
DList<int> *list;
list = new DList<int>();
[Code] .....
The errors returned by the compiler:
Error1error C2955: 'Node' : use of class template requires template argument listc:usersjumperdesktopc++ otherdouble linked listdouble linked listdlist.h6
Error2error C2955: 'Node' : use of class template requires template argument listc:usersjumperdesktopc++ otherdouble linked listdouble linked listdlist.h6
View 6 Replies
View Related
Apr 18, 2013
I have been working on the same problem as mp252 from an earlier thread and 4 days later, I appear to have it working. Mine only goes from 0-9999 though as I must move on!
Code:
#include <iostream>
#include <string>
int getThousands(int number);
int getHundreds(int number);
int getTens(int number);
int getUnits(int number);
void printNumber(int number);
[Code]......
I had a scrap of paper like a mad scientist trying to find relationships between numbers and the values that they would return through my functions. This is how I arrived at the conditions of my if statements in 'void printNumber'.
I have seen other code that allows a greater range but I can't quite follow it (yet):
C++ code by fun2code - 67 lines - codepad
View 1 Replies
View Related
Feb 25, 2013
I can not understand huge pointer, how its working.
#include<stdio.h>/ *How its working &decleration*/
int main(){
int huge *a =(int huge *)0x59990005;
int huge *b =(int huge *)0x59980015;
if(a == b)
printf("power of pointer");
else
printf("power of c");
return 0;
}
View 4 Replies
View Related
Mar 8, 2014
I’m writing an application for raw image processing but I cannot allocate the necessary block of memory, the following simple code gives me an allocation error.
double (*test)[4];
int block = 32747520;
test = new double[block][4];
off course with smaller block size (i.e. int block = 327475;) it works fine. Is there an allocation limit? How it is possible to deal with big blocks of memory?
View 2 Replies
View Related
Nov 3, 2013
I have been coding a while on a 2D random terrain game. How would I go about saving the maps? I have an array for blocks, lighting, background and background lighting. The lighting is done in real-time, so exclude that.
But with two 32000x3200 arrays, I still need to store 204800000 separate numbers in a file. Oh god. How can I have this? I could write down the separate numbers, but...yeah.
If it matters, this is made in freeglut.
View 2 Replies
View Related
Dec 31, 2012
I want to build a server which holds hundreds of thousands of active users in memory. To keep all the users organized i would like to store them in a Vector.
The problem is how i could quickly and easy find the object whenever i need it? All users will have a unique ID. Would it be possible to keep some form of a Vector Index on the unique id number?
View 2 Replies
View Related
Jun 14, 2012
i have a spec for fetch the files from server and predict the un-used files from the directory in this situation i am going to fetch the files from server it will return huge files, the problem is the cpu usage will increase while i am fetching large files, so i like to eliminate this scenario.
View 1 Replies
View Related
May 30, 2012
I am trying to understand what techiques can be used to sort really huge files (larger than available memory). I did some googling and came across one technique.
1. Are there any better ways to get this done?
2. Is there some tweaking that can be done to make this itself better?
Large enough so that you get a lot of records, but small enough such that it will comfortably fit into memory
3. How do you decide on this value? Consider, memory is 4 GB and currently about 2GB is consumed, and file to sort is 10GB in size. (Consumed memory could of course change dynamically during execution - consumed more/less by other apps.)
View 5 Replies
View Related
Oct 29, 2012
Here is the code:
int unsigned long a,b;
scanf("%lu",&a);
scanf("%lu",&b);
printf("%lu",a*b);
suppose we input a very large number on a and b (no more than 1000 digit)
like a = 1234567890123456789012345678901234567890
and b = 9876543210987654321098765432109876543210
it outputs 1, why is it?
It is probably the answer is too big, is there any way to show a*b?
View 1 Replies
View Related
Jan 2, 2013
My program is almost done all that is left is entering big numbers, the program can add and subtract small numbers but not big numbers because it puts them all in one node, I need the program to store each number in a node.
#include<iostream>
#include<string>
using namespace std;
class Node {
public:
int value;
Node * next;
[Code] .....
View 11 Replies
View Related
Mar 25, 2014
This is one part of my program, I need a loop that checks through the input(specifically the agent numbers) and then outputs the agent numbers that aren't in the input, from 1 to 20(because there should only be 20 agent).
My input is :
1 3 250.00
2 0 0
15 1 1000.00
3 4 300.00
12 2 500.00
1 2 300.00
3 4 115.00
21 3 400.00
-1 4 250.00
15 1 200.00
9 5 -150.00
18 2 140.00
13 2 550.00
the first numbers are the agent numbers so 1 , 2 ,15 are agent numbers and out output for agents who didnt participate are : 2 , 5 , 6 , 7, 8, 9, 10 , 11 , 14 , 16 , 17 ,19 20
this is the code ive wrote but its not working.
void not_part() {
ins.open(in_file);
int i=0;
int sum=0;
cout<<"AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN"<<endl;
cout<<fixed<<showpoint;
[code].....
View 1 Replies
View Related
Mar 24, 2014
This is one part of my program, I need a loop that checks through the input(specifically the agent numbers) and then outputs the agent numbers that aren't in the input, from 1 to 20(because there should only be 20 agent).
My input is :
1 3 250.00
2 0 0
15 1 1000.00
3 4 300.00
12 2 500.00
1 2 300.00
3 4 115.00
21 3 400.00
-1 4 250.00
15 1 200.00
9 5 -150.00
18 2 140.00
13 2 550.00
the first numbers are the agent numbers so 1 , 2 ,15 are agent numbers and out output for agents who didnt participate are : 2 , 5 , 6 , 7, 8, 9, 10 , 11 , 14 , 16 , 17 ,19 20
This is the code:
void not_part() {
ins.open(in_file);
int i=0;
int sum=0;
cout<<"AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN"<<endl;
cout<<fixed<<showpoint;
[Code] ......
View 11 Replies
View Related
Apr 27, 2013
i have to make a program where a user inputs one number and i have to find the number of a certain amount of number in the program.
for example:
user input: 2349354787839
output: There are two sevens
i know it has the use of loops but i am having trouble finding a way to scan each individual digit in the input to find if it is a seven or not.
View 8 Replies
View Related
Mar 7, 2014
Given up to 250000 numbers i have to produce a list of subsets(first of one element, then of two etc). Is there an easy way using a bitset<250000> ?
View 1 Replies
View Related
Dec 6, 2014
I am writing trying to store a list of numbers into an integer as bits. So far I have this:
n=n & 0x0f
integer = integer<<2
integer = integer | n;
convert(integer));
I want it to store the integers as bits so that I am move them over and store them farther down the row as more numbers are added, but instead each new number is being added to the previous and I'm just getting a larger integer. Is this even a feasible way to store integers within an integer?
View 1 Replies
View Related
Aug 21, 2013
Let's say that in a txt file named hot.txt, I have this:
12,23,32
And with ifstream I want to take those number, adding one by one as integers in a linked list.
ifstream myList;
char* p= new char;
cin>>p;
myList.open(p);
if(myList.is_open()) {
char* x =new char;
[Code] ....
I know this part is quite wrong :
myList.get(x,256,','); // dafaq
int num=atoi(x);
list->addOrdered(num);
What I wanted to do is to stop before each comma and take that character and store it in the linked list and continue until the end of the file, but I couldnt.
View 6 Replies
View Related
Dec 17, 2013
i have read a lot of about lists but i dont understand this. I know its something like dogs on leash where we have
dog1->dog2->dog3->....
and
Code:
struct DOG
{char* (name of a dog of first leash)
DOG* (next dog ) } I have written something like this but this doesnt work as i wanted Code: #include <iostream>
using namespace std;
struct line {
[Code]....
I wanted to make program where i can type XX numbers , then cout those numbers without changing the order, and my next exercise is to change order in this programme from end to start.
View 7 Replies
View Related
Apr 26, 2015
Rewriting a program to convert an array based list to a linked list. The program has a user guess a number [1-100] until the correct answer is guessed. I only want to give hints if a duplicate isn't guessed.
while (aGuess-> != p->guess) doesn't work and I haven't been able to troubleshoot myself.
while (aGuess->guess != p->guess) {
if ( aGuess->guess > a ) {
cout << "That's too high -- try again: ";
} // if guess > a
[Code] ....
View 1 Replies
View Related
Nov 1, 2013
I am a beginner and I ALWAYS have the toughest time doing I/O files. It's extremely frustrating. It "seems" it should be so simple. The program should find a code from a list of numbers. These numbers are from 0 - 9, and after each number is a space in the file. Your job is to extract a special code containing only 10 of those numbers. For the number to be part of the code, it should be divisible by 2. After extracting 10 numbers divisible by 2 for the code, write those 10 numbers to the file to form the expected code.
Input file is ("question.txt")
Output should be ("code.txt")
Should this contain a "for loop" or If/else ?
Here's what I did . .
/
// int numbers, total, counter;
ifstream inFile;
inFile.open ("question.txt");
outFile.open ("code.txt");
if (!inFile)
[Code] ....
View 2 Replies
View Related
Feb 8, 2014
How to randomly insert certain numbers into a linked list with 10 nodes. Meaning I want to put for example numbers 1 5 10 15 20 25 30 35 40 50 in random locations in the linked list.
View 1 Replies
View Related
Sep 11, 2014
Trying to output a .txt file of names emails and phone numbers, but this only outputs the list name: Email.PersonEntry.
private void button1_Click(object sender, EventArgs e) {
DialogResult result;
string fileName;
//Find and Open File
[Code] ....
View 6 Replies
View Related
Apr 6, 2013
1. Construct a class diagram that can be used to represent food items. A type of food can be classified as basic or prepared. Basic food items can be further classified as meat, fruit, veg or Grain. The services provide by the class should be the ability to enter data for new food, to change data for food and to display existing data about food.
using this class definition write a main program to include a simple menu that offers the following choices:
1. Add food
2. Modify Food
3. Delete Food
4. Exit this menu
2. Read a list of numbers from a file and then print them out in reverse order. State whether the list is palindromic or not.
View 2 Replies
View Related
Feb 16, 2013
I have a code able to import a file containing words and numbers to a linked list, but I also need to sort this linked list alphabetically. I've done research on this involving bubble sorting, but no explanationcan achieve this objective.
Below is the code that can only put the file into linked list:
Code:
#include<iostream>
#include<conio.h>
#include"U:C++WordClass2WordClass2WordClass.cpp"
#include<fstream>
#include<vector>
#include<string>
using namespace std;
[Code] .....
View 5 Replies
View Related