49,760 Topics

Member Avatar for
Member Avatar for JTX

Let's say there's list of numbers like this saved in a txt file: 4 6 3 4 5 How do I put it into an array?

Member Avatar for JTX
0
135
Member Avatar for spikeru

I am a beginner with C++ so please excuse my ignorance. I am attempting to pass a dynamically created 2d array to a function. The array the [3]x[variable] array is created like this. [CODE] //Create array for the transformed coords double **transf; transf = new double*[3]; for (int i=0;i<atoms;i++){ cout …

Member Avatar for vmanes
0
1K
Member Avatar for Sealunar

No matter what I do, I always get the numeric value from the ASCII chart. In this case I get 104, even though I denote Name[2] as a character. [CODE] string Name= "John"; cout << tolower ( char ( Name[2]) ) << endl; [/CODE]

Member Avatar for mrnutty
0
75
Member Avatar for noey699

if I wanted to do for example this [CODE]class MyClass{ float x,y; void SomeFunction() }; void MyClass::SomeFunction(){ MyClass A = this;//???? } [/CODE] How would I do that? I have virtually no experience with pointers so please help me out. I basically want to make the new class I am …

Member Avatar for noey699
0
96
Member Avatar for noey699

I have been trying to make a vector class to handle particles in a particle system I am making. The problem I have is when I try to change the dir it does not do what it is supposed to. If I keep pressing up it will just bounce back …

Member Avatar for noey699
0
125
Member Avatar for Excizted

Hey ! I've been using NetBeans for quite a long time, and totally addicted to it. Therefore there was no mercy when my mate wanted to join my project. - He had to get it too. He's one of those Windows guys tho x) I installed him MinGW and MSYS, …

0
65
Member Avatar for D4n1sD

Hello, I got a problem. Whenever I use rand() and I rerun the source I get the same results each time do u know whats wrong?

Member Avatar for clutchkiller
0
117
Member Avatar for Teach25

Given n points, how can I find how many different lines can be drawn through these points? Thanks

Member Avatar for mrnutty
0
130
Member Avatar for tango2009

I have this sprite that I am printing out sf::Image aNimat; if(!aNimat.LoadFromFile("images/fish.png")) std::cout<<"File not found fish.png"<<std::endl; however I want to print it out at random places and in random numbers. Can anyone suggest how I would go about it?

Member Avatar for mrnutty
0
55
Member Avatar for Salem

[I]<<thread split>>[/I] Who exactly? The OP left the forum 4 YEARS ago. And there the thread lay, nice and quiet until a day ago.

Member Avatar for Ancient Dragon
0
106
Member Avatar for Carrots

Hi there, I'm trying to return base class pointers from the two classes 'base' and 'child', but I keep on getting a build error of "1 unresolved externals". I think it may be because I am linking all the files together incorrectly. When I comment out the problem line in …

Member Avatar for Ancient Dragon
0
238
Member Avatar for merse

[CODE] #include <limits> using namespace std; const double double_nan = numeric_limits<double>::quiet_NaN(); double x = double_nan; if (x == double_nan) cout << "OK" << endl; [/CODE] I dont get OK! Why?

Member Avatar for dusktreader
0
100
Member Avatar for Gagless

I'm working on a bunch of stuff with arrays. At the moment I'm trying to come up with with an insert function that allows me to put as many elements as I want into an array, only keeping the five recent most elements. So I guess what I want to …

Member Avatar for WaltP
0
156
Member Avatar for PDB1982

Here is my assignment: "Define a class for rational numbers. A rational number is a number that can be expressed as the quotient of two integers. For example, ½, ¾, 64/2, and so forth are all rational numbers. (By ½ and so on we mean the every day fraction, not …

Member Avatar for tetron
0
2K
Member Avatar for lordvoldemort

How do I write a program that takes in some data files that have a bunch of numbers in them and then spits out certain numbers. Which then would be decoded using ascii values. You dont have to write the program, but it would really help full if you could …

Member Avatar for tetron
0
89
Member Avatar for kedarm

Hi! My problems are more of porting a code to Windows, than the code itself. I need to download a file from a URL ( http://127.0.0.1/img.jpg ) and store it in a local file. I think I've screwed up the setting up of the libcurl libraries. I am using Visual …

Member Avatar for Salem
0
1K
Member Avatar for sexyzebra19

I've followed an example from a website on how to use diff time, however its telling me that it took 0 seconds which obviously isn't right...can anyone please explain what I'm doing wrong? Thanks in advance! [code=php]int main() { time_t t1, t2; double dif; Matrix A(2); Matrix B(2); A.SetElement(1,1,1); A.SetElement(1,2,2); …

Member Avatar for Salem
0
419
Member Avatar for hgill006

Im brand new to C++ & Im having trouble with this program im writing i got all the way to the end of it working im just having problems using the setw function in reading and outputting from a file. I have my code attatched for what mine looks like, …

Member Avatar for lotrsimp12345
0
175
Member Avatar for eliza420

My problem is how to seek or search a word from my text file. here how it done. I want to search a word "Computer" found in my text file, and will output or will be print of screen as "Computer been found!" if the keyword are found and will …

Member Avatar for Fbody
0
169
Member Avatar for wilsonz91

Hello, I know i'm suppose to ask programming questions but i'm stuck on how to do it in the first place, the question is: You are given 4 information-gross pay, number of extra hours worked, the hourly pay rate, and the income tax rate. Calculate the overtime payment: Overtime payment …

Member Avatar for thomas_naveen
0
127
Member Avatar for Mridula J

Hi All, What all the difference between Macros and Inline functions. Why do they prefer inline functions? When Do macros come in use? What are the disadvantages of Macros and inline functions? thanks in advance

Member Avatar for mattjbond
0
129
Member Avatar for halluc1nati0n

I was trying out a 2-dimensional integer array on a UNIX box. I hit up a 'Segmentation Fault' on trying to run it. [CODE]#include <iostream> #include <cstdlib> using namespace std; int main() { int matrix[2000][2000]; int i, j; srand ( 1 ); for (i=0; i<2000; i++) { for (j=0; j<2000; …

Member Avatar for halluc1nati0n
0
207
Member Avatar for kedarm

Hi! I'm trying to build a Python extension with C/C++. I'm following the steps given in the documentation [URL="http://docs.python.org/extending/extending.html"]here[/URL]. I've followed the steps mentioned and written my first code. However, I have no clue on how to compile the project! I do not know how to create the .pyd file …

Member Avatar for kedarm
0
5K
Member Avatar for clutchkiller

[url]http://en.wikipedia.org/wiki/Brainfuck[/url] Interesting. One day once I figure out c++, I might give this a whirl!

Member Avatar for clutchkiller
0
82
Member Avatar for underground111

I NEED HELP WITH THIS ASSIGNMENT. I HAD THE WHOLE ASSIGNMENT DONE AND MY COMPUTER CRASHED AND LOST EVERYTHING. THE ASSIGNMENT IS DUE BY SUNDAY AT ANYTIME. I KNOW PEOPLE DONT LIKE IT WHEN YOU ASK FOR SOMEONE TO DO IT FOR THEM BUT IM NOT ASKING THAT I JUST …

Member Avatar for Nick Evan
0
174
Member Avatar for philosafari

I'm trying to compile the following code that I wrote out: [CODE]#include <iostream> #include <cmath> #include <iomanip> using namespace std; void gauss(double, double, double, int); int main() { const int n1 = 4; double prompt; double A1[n1][n1] = {{3,0,3,-4},{0,1,1,1},{1,1,1,2},{2,3,1,3}}; double b1[n1] ={7,0,6,6}; double x1[n1]; gauss(A1, x1, b1, n1); cout << …

Member Avatar for philosafari
0
113
Member Avatar for Carrots

Hi, I have been wrestling with this program all day and am looking for some help. I have never separated a program up before into separate files (main.cpp, base.h and base.cpp). What I'm trying to do is call a function from main() and have that function return a pointer to …

Member Avatar for Carrots
0
168
Member Avatar for Broseph

Hey guys. I hate to have to ask for help but I've run out of ideas. The program I'm trying to write is supposed to write a random list of numbers 0 - 4 and then count the occurrences of each number. The only thing I can't get to work …

Member Avatar for Broseph
0
83
Member Avatar for rudekhan

i just installed c++3.0 in XP downloaded from internet . But when i run very simple COUT<<"hello" code it doest produce out put. As i compile and run with out error but no output i can see. I have LCD is there any problem even i chaged the LCD and …

Member Avatar for rudekhan
0
265
Member Avatar for ELBUF

The title isnt too clear, and I wasnt sure what to title it, so Ill explain it here. I am making a calculator that can handle big numbers such as scientific notation and powers. A big number is one decimal (coefficient) times ten to a power (exponent). Ex. 3x10^15 or …

Member Avatar for ELBUF
0
123

The End.