| | |
Algorithm doubt
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Simple. Just use nested for loops.
will print the answer for two variables. Expand it for n variables.
C++ Syntax (Toggle Plain Text)
bool x1[2] = {true, false} bool x2[2] = {true, false} for ( i = 0 ; i < 1; i++ ) for ( j = 0 ; j < 1; j++ ) print x1[i], x2[j];
バルサミコ酢やっぱいらへんで
Maybe something like this which will implement a basic AND logic will help you understand the thing better:
Hope it helped, bye.
C++ Syntax (Toggle Plain Text)
int main () { bool first [] = {true, false} ; bool second [] = {true, false} ; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { cout << boolalpha << first [i] << " AND " << second [j] << " => " << (first[i] && second [j]) ; cout << endl ; } } return 0 ; }
Hope it helped, bye.
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- round robin algorithm (Computer Science)
- Selling text links, harm your ranking? (Advertising Sales Strategies)
- Round Robin Algorithm Simulation (C++)
- Eigenface Algorithm (Computer Science)
- Algorithm for checking contiguous blocks (C)
Other Threads in the C++ Forum
- Previous Thread: Reading specific line in a file. / Searching
- Next Thread: Need help writing an algorithm for this program
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class code coding compile console conversion count data database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






