Member Avatar

I recently started using Code::Blocks and have written a small program to read in from a file. I think the problem i am having is the file not being found. Where does the IDE search for the file and how would i change this? Can i just input the whole address of the file? Can post the test code if needed.

Member Avatar
0
3
Member Avatar

I am becoming annoyed at the amount of responses on this site saying (something along the lines of) "This thread is 5 years old, please leave it alone.". Then there is often the response (again, something along the lines of) "Please search the site before asking a question that has already been answered.". Surely updating an old post regardless of the period of time since the original post, will help anyone searching the site to find the required information without starting a new thread (making the search quicker for the next person i.e less hits). Does anyone else agree or …

Member Avatar
1
27
Member Avatar

I disagree with the idea of upgrading or degrading a poster anonymously without a reason. If you want to "score" someone on their post, surely you should have to give a reason why you did so. Do you think anonymous grading is the way to go?

Member Avatar
0
17
Member Avatar

Sorry if i'm in the wrong forum but here goes: Does anyone know how to restore a Toshiba Satellite laptop back to the factory settings? The laptop did not come with any back-up discs.

Member Avatar
0
2
Member Avatar

[URL="http://www.youtube.com/watch?v=lyZQPjUT5B4"]The coolest bubble-sort ever.[/URL]

-2
1
Member Avatar

English rioting for no apparent political reason, more a case of get what you can while the going is good. Does it get much worse than [URL="http://www.bbc.co.uk/news/magazine-14487982"]this[/URL]? Is society really broken?

Member Avatar
0
43
Member Avatar

At what point does conciseness become more important than readability, or vice-versa (given that there is no difference in performance)? Is there an element of snobbery amongst programmers to certain techniques or are certain things just purely bad practice?

Member Avatar
0
3
Member Avatar

I wrote this test code trying to work out a problem. The code gives the correct answer for the example (zero) but to understand the problem i need to understand what the code is doing on a sort of step by step basis. In other words how to do it with a pen and paper. The answer is 3240 i just don't know why. Can anyone help? [CODE]#include <iostream> using namespace std; int fun(int n); int a=50; int b=2000; int c=40; int main() { cout<<fun(0)<<endl; return 0; } int fun(int n) { if(n>b) return n-c; if(n<=b) return fun(a+fun(a+fun(a+fun(a+n)))); }[/CODE]

Member Avatar
0
7
Member Avatar

I have got to get one of [URL="http://www.bbc.co.uk/news/technology-12997245"]these[/URL].:icon_cool:

Member Avatar
1
7
Member Avatar

Is there a way of telling from a post (including my own) if someone just isn't cut out for programming? For example a really simple piece of logic not being understood (as opposed to a lack of knowledge of the language).

Member Avatar
0
21
Member Avatar

1. When posting a link, how do i make my link look like [COLOR="Red"]here[/COLOR] instead of [url]http://blablabla?[/url] 2. When quoting someone else, how do i let people know who i'm quoting? 3. How do i create a link like this?[URL="http://www.daniweb.com/community-center/geeks-lounge/threads/341464"]http://www.daniweb.com/community-center/geeks-lounge/threads/341464[/URL]

Member Avatar
0
8
Member Avatar

It may not turn out as you [URL="http://www.dailyrecord.co.uk/news/weird-news/2011/03/22/blundering-surgeons-cut-off-man-s-testicles-86908-23007198/"]expected[/URL].

Member Avatar
0
8
Member Avatar

As a beginner i am very thankful for the advice given by people who clearly know far more about the subject than myself. I have answered some threads that i feel i understand (sometimes), but i regularly see "experts" answering the most basic of questions (including mine). Are you people just genuinely good human beings?

Member Avatar
0
38
Member Avatar

I managed ~120 in c++(no big-nums in c++, made it a bit harder) with no external libraries and a "very" limited knowledge of programming. Have hit the wall now (mostly the math i think). Has anyone else given this a go and how did they do? This is not supposed to be a bragging contest, just curious to know how others did.

Member Avatar
0
23
Member Avatar

[CODE]bool is_prime(int a) { if(a==1){return false;} if(a<4){return true;} if(a%2==0){return false;} if(a<9){return true;} if(a%3==0){return false;} int i; for(i=5;(i*i)<=a;i+=6) { if(a%i==0){return false;} if(a%(i+2)==0){return false;} } return true; } [/CODE] critique welcome.

Member Avatar
0
28
Member Avatar

Hey there. I'm trying to figure out how to subtract one array of integers from another. I have figured out how to add 2 together going digit by digit and carrying over. I have no idea how to go about subtracting one from another. Basically i want to do simple calculations on numbers that long long wouldn't hold. I also want to do it using the standard library. Does anyone have any hints on how to start or a link to a tutorial? Any help is most appreciated.

Member Avatar
0
3
Member Avatar

Can anyone tell me how to find the maximum value for a specific variable(i.e int, long long int, double)? Also is there a way to set a variable to this value(without knowing it and typing it in)? Using Dev C++. Any help appreciated.:)

Member Avatar
0
6
Member Avatar

Can anyone tell me if it is possible to set a value in an array to infinity and if so how to go about it? Thanks.

Member Avatar
0
4
Member Avatar

Hey, i know this is a commonly asked question (and will probably get burned for asking it again) but wanted an up to date answer so here we go. I'm trying to learn to program in c++ purely as a hobby. I have recently spent some time doing problems at [URL="http://www.projecteuler.net/"]http://www.projecteuler.net/[/URL] and found it quite enjoyable (and due to the problems, learned some stuff i.e file I/O, use of arrays, vectors etc.) but i've got to the point where the maths has got me beat. Done all the ones i can find that are brute-forceable. I have some books on …

Member Avatar
0
14
Member Avatar

hi again, i'm just full of problems. i have a vectors of ints and i am trying to find a way to check if there is a repeatting sequence within the vector and what size this sequence is. Does anyone have any suggestions on how i should go about this? not looking for code just a nudge in the right direction. :)

Member Avatar
0
6
Member Avatar

in my code i have declared [CODE]typedef signed long long int slong; const slong limit=4000000; const slong limitsqr=2000;[/CODE] i then created an array [CODE]slong* array=new slong[limit];[/CODE] without any problem. when i try this [CODE]slong* newarray=new slong[limitsqr][limitsqr];[/CODE] i get the error message: in function int main() cannot convert slong(*)[2000] to slong in initialization can anyone point out where i'm going wrong?

Member Avatar
0
8
Member Avatar

Hi, new to this so go easy. I'm trying to store a function i wrote in a file and call it with a header file rather than copy and paste as ive been doing but i keep getting error messages from the compiler. Can anyone point out what i'm doing wrong? the header file is: [CODE]#ifndef GUARD_is_prime_h #define GUARD_is_prime_h bool is_prime(unsigned long long int); #endif[/CODE] this is saved as is_prime.h is_prime.cpp is; [CODE]bool is_prime(unsigned long long int a) { if(a==1){return false;} if(a<4){return true;} if(a%2==0){return false;} if(a<9){return true;} if(a%3==0){return false;} unsigned long long int i; for(i=5;(i*i)<=a;i+=6) { if(a%i==0){return false;} if(a%(i+2)==0){return false;} …

Member Avatar
0
10
Member Avatar

How do i create a large array in c++? Apologies if this has been answered already but after searching didn't find what i was looking for. i want to create an integer array of size 1500000 i.e int array[1500000] but my compiler wont allow it. I remember seeing something about using "new" but can't remember where i saw it. As you can tell am just beginning and trying to learn online(difficult). If anyone could point me in the right direction or suggest a link to something it would be much appreciated.

Member Avatar
0
8
Member Avatar

Sorry if this is repetative but still struggling with this. i wish to multiply 2 long integers together. if the result is outside of int64 range i want the loop to break otherwise i want to keep the result and increment the second number. have tested this, but when the result is out of range it returns a garbage value. is there any way of making this result 0 for example when this is the case. thanks.

Member Avatar
0
3
Member Avatar

when i try to use pow with cmath header i get error message pow(int,int)is ambiguous it also gives other possible options i.e pow(double,int) why is int^int ambiguous? how could it be less ambiguous?

Member Avatar
0
3
Member Avatar

hi, beginner question i am planning to write code for different values of a^b. both a and b will vary in the program and both will be long long ints; as my compiler wont allow pow(int,int) as it is ambiguous(dont know why) either while have a as a double and cast it to LL int or just use multiplication with a as LL int. Sorry im rambling. My question is how do i terminate the loop when a^b is out of LL int range instead of it just returning me a garbage value and carrying on? In other words b …

Member Avatar
0
7
Member Avatar

trying to write a fuction to work out the GCD of two numbers seems to run ok but the return is incorrect any help much appreciated #include <iostream> #include <cmath> using namespace std; int g_c_d(int a,int b); int main() { cout<<g_c_d(2871,4060);/*test example*/ cout<<endl; system("pause");/*been advised not to use this but at my level well hey!*/ return 0; } int g_c_d(int a,int b) { int c; c=abs(b-a); cout<<a<<" "<<b<<" "<<c<<endl;/*put this in to check it was going ok*/ if(c==0){return a;} if(b>a){b=a;} a=c; g_c_d(a,b); } returns 4249024 instead of 29 sorry this may be double post just new to this didnt know …

Member Avatar
0
7
Member Avatar

Hey there, this code was supposed to work out th GCD of 2 numbers added cout line in function and code seems to be running fine but it returns 4249024 instead of 29 this is probably a basic error on my part but can anyone tell me why? thanks for any help as is quite clear am a beginner at this.[code]#include <iostream> #include <cmath> using namespace std; int g_c_d(int a,int b); int main() { cout<<g_c_d(2871,4060);/*test example*/ cout<<endl; system("pause");/*been advised not to use this but at my level well hey!*/ return 0; } int g_c_d(int a,int b) { int c; c=abs(b-a); …

Member Avatar
0
2
Member Avatar

Hi, total beginner here, trying to learn at home. Just thought i'd get that in. if i have a number eg 123 trying to figure out a way of calculating all the possible cominations 123 132 213 231 312 321 can do it with pencil and paper but don't know where to start with program can anyone help?

Member Avatar
0
9
Member Avatar

Hey there. Just beginning to learn c++ on my own(not easy). Please fogive my lack of knowledge. I have a list of large numbers(50 digits) that i copied. I want to split them into an integer array of size [100][50]. I dont want to have to go through and put in all the commas(obviously >4000). Does anyone have any suggestions for an easier way. thanks in advance.

Member Avatar
0
7

The End.