Forum: C Mar 29th, 2007 |
| Replies: 17 Views: 4,571 Re: Prime Number program.. with a twist you are adding counter twice in your loop, need to remove one.
void primeTest(int n)
{
int temp = 2;
for (int counter=1; counter<=n; counter++)
{
cout << "Prime number " << counter <<... |
Forum: C++ Aug 26th, 2005 |
| Replies: 8 Views: 1,434 Re: Problems with the executable... It might be that you are linking with some dll's that aint in the folder you are executing from or in the system folder. try to look at the propeties for the project in VC and see if they link to... |
Forum: C++ Aug 24th, 2005 |
| Replies: 7 Views: 4,479 Re: word count Words are generaly seperated by spaces, so look for spaces between charaters. |
Forum: C++ Aug 15th, 2005 |
| Replies: 13 Views: 1,631 Re: Help ME >He said "factorial," zyruz.
My bad :)
you can also use a while loop:
#include <iostream>
using namespace std;
int main ()
{ |
Forum: C++ Aug 15th, 2005 |
| Replies: 13 Views: 1,631 Re: Help ME you can do somthing like this:
#include <iostream>
using namespace std;
int main()
{
int num = 50; // test num |
Forum: C Aug 12th, 2005 |
| Replies: 6 Views: 2,320 Re: Write to a file becuse you are writing to the file after you are done with the loop. so put
file<< i <<" "<< j1 <<"\n" ;
inside the loop |
Forum: C Aug 12th, 2005 |
| Replies: 6 Views: 2,320 Re: Write to a file file<<"%d file\n",rand();
cant be dont this way, it is not printf() that you are using :)
try:
file << rand() << " file\n"; |
Forum: C++ Aug 10th, 2005 |
| Replies: 12 Views: 2,830 Re: Array >Ok But how can i get the value of the 5th element? does cout<<a[5]; will do?
well,it will ouput the 6'th element, since arrays start on 0.
>And what if i want to output all the elements? do I... |
Forum: C Aug 8th, 2005 |
| Replies: 7 Views: 2,847 |
Forum: C Aug 8th, 2005 |
| Replies: 5 Views: 1,790 |
Forum: C++ Aug 7th, 2005 |
| Replies: 20 Views: 3,888 |
Forum: C++ Aug 3rd, 2005 |
| Replies: 7 Views: 1,449 Re: need an imagination i suppose. well it is kinda har to guess wath you want for req's when I have no idea wath max req's and sutch are, so I'l just poste some name:
Weapons:
Hammer of Thor (pref do some extra lightning dam :)... |
Forum: C++ Aug 2nd, 2005 |
| Replies: 8 Views: 3,751 |
Forum: C Jul 31st, 2005 |
| Replies: 5 Views: 1,183 Re: Vector with Multiple Memebers if you are trying wath I think you are you need to change
struct Output
{
double *var1;
double *var2;
double *var3;
}
to
struct Output |
Forum: C Jul 31st, 2005 |
| Replies: 5 Views: 1,183 Re: Vector with Multiple Memebers for(int i = 0; i < 512; i++)
{
output[i].var1 = (double *)i;
output[i].var2 = (double *)i;
output[i].var3 = (double *)i;
}
shuld populate it. |
Forum: C++ Jul 30th, 2005 |
| Replies: 18 Views: 2,587 Re: Algebraic question I have taken a closer look on your code, and think I see wher your error is.
y = x/150*(log(pl/1.5));
and
y = x/(150*(log(pl/1.5)));
are 2 completly diferent calculation. this might be your... |
Forum: C++ Jul 30th, 2005 |
| Replies: 18 Views: 2,587 Re: Algebraic question log(x) ; returns the natural log of x, accept it.
Are you sure that you are thinking of log?
can you give us a couple of examples of wath you want to be done?
Guessing wath you want is... |
Forum: C++ Jul 30th, 2005 |
| Replies: 5 Views: 1,388 |
Forum: C++ Jul 30th, 2005 |
| Replies: 18 Views: 2,587 Re: Algebraic question log(x) is the natural logarithm of x (base e)
log10(x) is the common logarithm of x (base 10) |
Forum: C++ Jul 29th, 2005 |
| Replies: 18 Views: 2,587 Re: Algebraic question the probleme is that you have declared log as a float. and a float is not a function and a float variable cant be used as a function.
so ether change (150*log(pl/1.5)); to (150*std::log(pl/1.5));
or... |
Forum: C++ Jul 29th, 2005 |
| Replies: 2 Views: 1,654 |
Forum: C++ Jul 25th, 2005 |
| Replies: 9 Views: 3,819 Re: backward string Dont try to print out a void function.
change cout << Backward(line) << endl;
to
[CODE]
Backward(line);
cout << endl;
[CODE] |
Forum: C++ Jul 19th, 2005 |
| Replies: 15 Views: 3,545 Re: 2-D array make the key 1d?
like:
char key[20]= {'B', 'D','A','A','C','A','B','A','C','D','B','C','D','A','D','C','B', 'B','D','A'};
remove : "change answer[quest-1] = choice;" and put:
if (choise ==... |
Forum: C++ Jul 19th, 2005 |
| Replies: 15 Views: 3,545 Re: 2-D array why do you need to have this as a 2d array?
if you just want the numbers 1-20, you can change the function StudentAns to:
void StudentAns(char answer[20])
{
for (int quest = 1; quest <=20;... |
Forum: C++ Jul 19th, 2005 |
| Replies: 6 Views: 2,071 |
Forum: C++ Jul 19th, 2005 |
| Replies: 7 Views: 1,751 Re: Need help with integers in c++ If I aint totaly wrong Dave ment somthing like this:
char ch[] = "abcdefghijklmnopqrstuvwxyz"; // character array
char testc = 'c'; // wath we are looking for
int res = -1;
for (int... |
Forum: C++ Jul 18th, 2005 |
| Replies: 9 Views: 1,899 Re: Array small tips:#include <iostream.h> is old style, use <iostream>, and main shuld return int (int main).
Ok, I dont know if you have loearnt about vectors, but if so, they wold be a better choise for... |
Forum: C++ Jul 18th, 2005 |
| Replies: 9 Views: 1,899 Re: Array Well you have newer declared i, before refering to it in if(!count[i] % 2) // if divisible by 2, then returns zero, negates to 1, enters if
even[i] = count[i];
else
odd[i] = count[i];
just so you... |
Forum: C++ Jul 17th, 2005 |
| Replies: 4 Views: 1,660 Re: asterisk serial form I only recommanded that he used function, the system("pause ") was only becuse mixsir used it in his code. |
Forum: C++ Jul 16th, 2005 |
| Replies: 13 Views: 55,220 |
Forum: C++ Jul 16th, 2005 |
| Replies: 4 Views: 48,232 |
Forum: C++ Jul 15th, 2005 |
| Replies: 7 Views: 1,942 Re: Menu Chooser Program it show the menu 1,2 and 3 becuse in if (myDifficulty = 3) you aint checking, you are asigning the value 3 to myDifficulty change it to if (myDifficulty == 3) |
Forum: C++ Jul 15th, 2005 |
| Replies: 7 Views: 1,942 Re: Menu Chooser Program no match for 'operator>>' in 'std::cin >> myDifficulty' is the error I get, and it means that you havent declared anny overload for the >>. but use int for geting the choise, and use the enum for... |
Forum: C++ Jul 15th, 2005 |
| Replies: 7 Views: 1,942 Re: Menu Chooser Program Your probleme lies in if (myDifficulty = 3)
You are only asigning the value 3 (or 1 or 2) to the myDiffculty, change the '=' too '==' and it shuld work.
You arent using the enum difficulty.... if... |
Forum: C++ Jul 15th, 2005 |
| Replies: 4 Views: 1,660 Re: asterisk serial form Your main probleme is that you have bad design. Try to figure out how to do somthing before you try to code it :).
But, I rewritten your code:
#include <iostream> // use <iostream> instead for... |
Forum: C Jul 13th, 2005 |
| Replies: 1 Views: 1,514 |
Forum: C++ Jul 13th, 2005 |
| Replies: 10 Views: 1,871 Re: Is this the forum I use for help? Well, it cold be that dave, but he is using cin.ignore(std::cin.rdbuf()->in_avail() + 2); as a system("pause"); and there can be code afterthe pause, and then it would be a bug. |
Forum: C++ Jul 13th, 2005 |
| Replies: 10 Views: 1,871 |
Forum: C++ Jul 10th, 2005 |
| Replies: 13 Views: 5,304 Re: hexadecimal.cpp Well for me it seems that he is trying to reinvent the wheel for a school projeckt, and not use standar function. |
Forum: C++ Jul 10th, 2005 |
| Replies: 13 Views: 5,304 Re: hexadecimal.cpp desidude: try somthing like this:
std::string Hex(int num)
{
std::string s1;
char sign[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
int div,
base =... |