Hi all,
I have a little question, my compiler is giving me the following error:
error C2784: 'std::basic_ost ream<_Elem,_Tra its> &std::operat or <<(std::basic_o stream<_Elem,_T raits> &,const std::basic_stri ng<_Elem,_Trait s,_Alloc> &)' : could not deduce template argument for 'std::basic_ost ream<_Elem,_Tra its> &' from 'std::istream'
see declaration of 'std::operator <<'...
User Profile
Collapse
-
How do I input a text file to a linked list?
Hello everyone,
I need to load a multi-word strings from a file to a linked list in one of my programs, and i'm not sure how to do that.
my text file looks like this- (the name of the text file is: names.txt)
Linda
Martinho
Marla
Jose
Mary
Luka
Joseph
Thiago
Ruba
Here is one of my sample code:
...Code:#include
-
Nevermind.. I already found the error.
Thank you for the help,
~doug -
Thanks for the help.
I already got the algorithm to reduce the fraction.
My header file is looking like this now
...Code:// This program was created by Douglas Alves // CS 1410 #include <iostream> using namespace std; class fraction { private: int numerator; int denominator; public: fraction() : numerator(0),Leave a comment:
-
Fraction Program - Reducing it to the lowest terms
Hello everyone,
I'm creating a program that it is suppose to add, subtract, multiply and also divide fractions and after that, the result has to be reduced to the lowest terms.
However, I'm not sure how the algorithm of reducing fractions works.
Here is part of my code:
...Code://Header File #include <iostream> using namespace std; class fraction
-
-
So one more question..
The member-function definitions of a class template are function templates?
thanks,
dougLeave a comment:
-
-
-
Templates
Hi,
I need to create a program that works with class templates and regular function templates.
Can I create one single program that works with both in the same code?
Sorry for the question but all programs that I was looking just works with one or the other.
Thanks,
doug -
Hey,
So I started the code, and I'm getting 2 errors from the compile that I can't figure it out..
The errors are in those lines
...Code:if (testA == 1 || testA == 2 || testA== 3 || testA == 4 || testA == 5) { if(testB == 2 || testB == 3 || testB = 4 || testB == 5) { if(testC == 3 || testC == 4 || testC == 5) { if(testD== 4 || testD ==5)Leave a comment:
-
-
Hi,
Thanks for the quick answer.
For example,
Given the function f, from {1 2 3 4 5}, to itself. Than I have to check if it is a one-to-one function and also if it is a onto function.
The program will test the following functions:
f(1) = 4
f(2) = 3
f(3) = 1
f(5) = 2
Thank youLeave a comment:
-
Function Program
Hello,
I need to write a Function program that will check if a function is valid or not and also if the function is onto as well.
Kind of getting started right now, so any ideas will be great.
Thank you! -
Hello!
Thank you so much for the help everyone..
Have a good Sunday! ;)
~dougLeave a comment:
-
Thanks for the support,
but it is suppose to give the percentage of times that it happened.. But anyways, thanks!Leave a comment:
-
Do you mean
??Code:int verify_1(int diceA, int diceB, float *roll) { if(diceA==diceB) *roll++; return *roll; }
Because the compiler say that it has to return a value...
~dougLeave a comment:
-
Okay, thanks.
It looks like this now
But how do I initialize it from the different number everytime?Code:int verify_1(int diceA, int diceB) { int roll=0; if(diceA==diceB) roll++; return roll; }
Example(Roll=1, roll=2,roll=3.. etc)
~dougLeave a comment:
-
I started the code again..
Here is my code now
...Code:#include <iostream> #include <ctime> using namespace std; void randomize(); int verify_1(); void calculate_1(); int rolldie(); void randomize(int *diceA, int *diceB) { srand((unsigned)+time(NULL)); *diceA = rand() %6+1; srand((unsigned)+time(NULL));Leave a comment:
-
Okay..
Finally I got one step done..
I got the loop working correctly..
Here is the code
...Code:for(int total=1; total<=1000000; total++) { diceA = rolldie(); //value 1-6 diceB = rolldie(); //value 1-6 if(diceA==diceB) { cout << setw(7) << "The dice were equal: " << total << endl; } }Leave a comment:
No activity results to display
Show More
Leave a comment: