49,760 Topics

Member Avatar for
Member Avatar for EXpoZuR

I have to read numbers from a .txt file and sort them. I am trying to use selection sort. The .txt file looks like this: 3 33.3 92.5 4.5 6.29 5.3 94.3 -7.455 4.66 -9.33 -211.2 .03 .12 0.34 4.83 2.494 I am now working on the first 5 numbers …

Member Avatar for EXpoZuR
0
215
Member Avatar for Ahmed2

Hello every body I'm trying to iterate through a list for a certian number of times using a for loop. below is the current code I've written, but this will iterate through the list until it ends. [CODE]list<FileInfo*>::iterator p = currentlist.begin(); while(p != currentlist.end()) { cout << (*p)->remainingtime << " …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for marcux

Hi all! I am quite new to C++ and just been hacking with stdlib. When I want to start hacking other things outside stdlib, like network aso. I get confused and can not find what I am looking for. I use GNU/Linux and want to use "native" libs for that. …

Member Avatar for Schol-R-LEA
0
118
Member Avatar for NatherLaci
Member Avatar for thines01
0
283
Member Avatar for Zssffssz

I want to make a program that makes and extracts tar files from scratch a other sit said that using wikipedias specifications it's easy but I don't know how to do half that stuff! Like makeing the thing to the right size moving where it writes and reads to. Making …

Member Avatar for Clinton Portis
0
91
Member Avatar for Danizand

I am trying to extract data from multiple files into one output file. At the moment I am able to extract the columns I want into a vector in a vector: [code] vector< vector<double> > out; //2D vector ofstream myfile ("example.txt"); //outputfile //the data contained in data[n][6] is put into …

Member Avatar for Danizand
0
2K
Member Avatar for mits28

[CODE]#include<iostream.h> #include<conio.h> #include<process.h> struct node{ int data; node *next; }; class Linklist{ node *ptr,*save, *head, *tail; public: void ncreate(); void display(); void insert(); }; void Linklist:: ncreate() { while(1) { ptr = new node; cout<<"enter info:"; cin>>ptr->data; if(ptr->data==-999) { return; } if(head==NULL) { head=ptr; tail=ptr; } else { tail->next=ptr; tail=ptr; …

Member Avatar for WaltP
0
109
Member Avatar for stereomatching

What is the meaning of attributes defined by boost::spirit? [code] namespace qi = boost::spirit::qi; qi rule<std::string::const_iterator, double()> simple_rule = qi::double_ >> *(',' >> qi::double_); [/code] only double_, int_ equal to attributes or ',' also is an attribute? Thanks

0
72
Member Avatar for jeffcogswell

Netbeans is a free, open source IDE for developing software in Java. It's been around for almost 15 years, having gotten its start around the time Java began. Version 7.0 is about to be released, and I got my hands on the Beta release of this new version. In the …

Member Avatar for cyvre
3
380
Member Avatar for subith86

Hi all, Sorry if this is a stupid question. Assume I have a code like this. [CODE] char *temp = "poiuytrewq"; std::cout<<*temp<<std::endl; //should print p function(temp); std::cout<<*temp<<std::endl; //should print i [/CODE] Basically my function() in the above snippet increments the pointer twice so that temp point to 'i' now. I …

Member Avatar for subith86
0
177
Member Avatar for Xaviorin

I'll keep it simple and hopefully whatever simple error I keep overlooking can be used as a learning experience for others. This program uses a user created file called patient.dat that contains the following: Smith Eleanore 110/73 Jones Tom 200/78 The error I am having is that Mr Tom Jones …

Member Avatar for Xaviorin
0
236
Member Avatar for coolbeanbob

Hello everyone, Like the headline says, my computer goes crazy when I run this program. The problem did not occur until I added lines 80-83. When the program is run, my computer starts beeping and weird characters show up on the console. Any thoughts on the problem and why it …

Member Avatar for WaltP
0
150
Member Avatar for azuresapphic88

I don't know what this problem is asking me to do : initialize both i and n in the same line. Initialize n to 0, and i to 0. This problem is in the Loop Chapter: for (int i = 0; i <= 5; i++) cout << i << " …

Member Avatar for WaltP
0
84
Member Avatar for abhilash mohan
Member Avatar for WaltP
0
39
Member Avatar for jcAmats

hi! can someone help debug my codes? getline() works properly in my main() but if i'm putting it to another function, it ignores the first getline() w/o entering any words and goes to the 2nd getline. my program works like this: i have a menu() that lets the user to …

Member Avatar for jcAmats
0
379
Member Avatar for EXpoZuR

Hello, I am currently doing an assignment where I have to read numbers from a .txt document into an array and later find the average of different lines of the .txt document sort them and what not. I'm not even close to the ladder parts of this assignment and I …

Member Avatar for EXpoZuR
0
217
Member Avatar for Jdan2388

ok so in my program i'm supposed to read data from a text file and store it in arrays then make calculations from my array. so there will be three functions for the program 1 will be the readfile() which will read the file the other will be calculatedata() which …

Member Avatar for Jdan2388
0
259
Member Avatar for Nakeo

Im writing a program that uses sockets for inter process communication however i have come to a road block and cant get my code to compile. i have googled all the errors with no luck finding a solution. If any one can help me it would be appreciated. Here is …

Member Avatar for Nakeo
0
206
Member Avatar for iv54

im trying to print the array 5 times, each time containing different numbers but it repeats the same random numbers. help please. [CODE] while(count<5){ fillarr2(ran1,ran2); printar(ran1,ran2,counting); } // functions void fillarr2(int raa[],int rab[]){ int ran1,ran2, i,count=0; srand(time(NULL)); for(i=0;i<10;i++){ ran1=rand()%15+1; raa[i]=ran1; } for(i=0;i<10;i++){ ran2=rand()%15+1; rab[i]=ran2; } return ; } void printar(int …

Member Avatar for Fbody
0
171
Member Avatar for Thermalnuke

This program is suppose to input a date and output the day of the week that corresponds to that date. I have the program all done, but the code is not presented in the main() of the form. Im guessing i have to organize it a little more. any ideas …

Member Avatar for WaltP
0
185
Member Avatar for MediumSoda

I need some help with a code I'm writing. The user inputs some letters, a loop is ran to check if it's a vowel or consonant, then when the user is done it returns the total amount of vowels and consonants. The problem I'm having is the loop is suppose …

Member Avatar for MediumSoda
0
423
Member Avatar for megatron21

I am trying to print out a chess board on the console. The data structure i am using is a set of pairs. I am having trouble accessing the pair's elements. I do realize a map is probably better in this case but i am using somebody else's code so …

Member Avatar for gusano79
0
241
Member Avatar for Sgt. Pepper

So, here I am again, with my mass of code, albeit with more progress. It's still got a long way to go, and I'm still not that good at coding, but man oh man have I learned a lot through this game. I come with a few more questions than …

Member Avatar for Sgt. Pepper
0
298
Member Avatar for lukesawyer

I made my console application up in Visual C++ 2010,have a icon for it,but don't know how to place it.I know it's not important and that i can use additional software for that, so answer directly, i just want to know. Thanks !

Member Avatar for skaa
0
56
Member Avatar for sita12345

Hi, I would like to know how to add the objects of a vector?I wrote a code where it is adding the values to a specific object.I wanted to write a code where it can add all the values of all objects in a vector?

Member Avatar for Clinton Portis
0
121
Member Avatar for dumbc++guy

Hi, I am learning C++ and am writing a program to create a Unique List of words. I am having problems getting my struct count field to increment in my createUnique function. After returning from the Search function, the count field within the struct needs to increment if the key …

Member Avatar for Schol-R-LEA
0
211
Member Avatar for easterbunny

Hi all, I got a problem.I got to make a program that sorts the digits inside a number given by the user, but I can't use an array. I know that the easiest way is with the bubble sort but I can't seem to make a switch between two digits …

Member Avatar for easterbunny
0
2K
Member Avatar for NoUserNameHere
Member Avatar for SCass2010

Hi, I current I have a vector <void*> that I need to populate with values, stored as char*. Is there a way to convert to void*, then back to char* whenever needed? I have tried casting and using static/reinterpret_cast but when I try to output (converting from void* back to …

Member Avatar for SCass2010
0
1K
Member Avatar for sita12345

Hi, main.cpp vector<Employee>e; e.push_back(Employee("Hawaii",100)); cout<<endl; e.push_back(Employee("Scotland",20)); cout<<endl; e.push_back(Person("Saga",30)); cout<<endl; Employee e1; //created an object sort(e.begin(),e.end()); e1.show(e); Employee.h bool operator<(const Employee& e1,const Employee& e2); Employee.cpp bool operator<(const Employee& e1,const Employee& e2) { return e1.getName() < e2.getName(); } With this code it is just sorting only the first 2 objects and displaying …

Member Avatar for Fbody
0
93

The End.