Forum: C Mar 29th, 2007 |
| Replies: 17 Views: 6,910 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 " <<... |
Forum: C++ Aug 26th, 2005 |
| Replies: 8 Views: 1,710 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: 5,464 Words are generaly seperated by spaces, so look for spaces between charaters. |
Forum: C++ Aug 15th, 2005 |
| Replies: 13 Views: 2,034 >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: 2,034 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: 3,042 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: 3,042 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: 4,091 >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: 3,100 You can do somthing like this:
#include <iostream>
using namespace std;
int main()
{
char test[] = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.!:;? ";// all the chars... |
Forum: C Aug 8th, 2005 |
| Replies: 5 Views: 2,339 becuse you dont use CODE tags.
http://www.daniweb.com/techtalkforums/announcement8-3.html |
Forum: C++ Aug 7th, 2005 |
| Replies: 20 Views: 4,724 try to use a filname without space :)
it worked for me then |
Forum: C++ Aug 3rd, 2005 |
| Replies: 7 Views: 1,742 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: 4,972 tried using wchar_t instead of char? |
Forum: C Jul 31st, 2005 |
| Replies: 5 Views: 1,467 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,467 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: 3,116 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: 3,116 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 hard.
... |
Forum: C++ Jul 30th, 2005 |
| Replies: 5 Views: 1,713 you can do it that way, but yo loose alot of readability! |
Forum: C++ Jul 30th, 2005 |
| Replies: 18 Views: 3,116 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: 3,116 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));... |
Forum: C++ Jul 29th, 2005 |
| Replies: 2 Views: 2,137 From http://www.daniweb.com/techtalkforums/showthread.php?t=27800
use <iostreram> instead of <iostreram.h> |
Forum: C++ Jul 25th, 2005 |
| Replies: 9 Views: 6,090 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: 4,656 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: 4,656 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,431 You can do it like this:
#include <iostream>
struct alphab
{
int num;
char ch;
};
int main() |
Forum: C++ Jul 19th, 2005 |
| Replies: 7 Views: 1,956 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... |
Forum: C++ Jul 18th, 2005 |
| Replies: 9 Views: 2,385 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: 2,385 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... |
Forum: C++ Jul 17th, 2005 |
| Replies: 4 Views: 1,907 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: 84,876 It is printing the number multiple times, becuse of:
for ( int j = 2; j <= i/2; j++)
{
if ( i % j == 0 )
{
check_prime = 0;
... |
Forum: C++ Jul 16th, 2005 |
| Replies: 4 Views: 88,994 somthing like this:
#include <iostream>
int main ()
{
char c[6] = "45678";
int num[5];
for (int i = 0; i < 5; i++)
{ |
Forum: C++ Jul 15th, 2005 |
| Replies: 7 Views: 2,618 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: 2,618 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: 2,618 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....... |
Forum: C++ Jul 15th, 2005 |
| Replies: 4 Views: 1,907 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: 2,558 If I aint completly wrong you need to include fstream. |
Forum: C++ Jul 13th, 2005 |
| Replies: 10 Views: 2,260 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: 2,260 just change the
cin.ignore(std::cin.rdbuf()->in_avail() + 1);
to
cin.ignore(std::cin.rdbuf()->in_avail() + 2); |
Forum: C++ Jul 10th, 2005 |
| Replies: 13 Views: 8,167 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: 8,167 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,
... |