Iam reading in a 4row 3column table.
Iam refering to char_function[4][3] in the following code.This is a part of a larger program. You can neglect all other things and look at char_function
my aim is to print it out
#include<iostream>
using namespace std;
int N, Q, M;//number of user inputs, states, and outputs of the machine
char char_table[4][3] = { {0,0,0},
{0,1,0},
{1,0,0},
{1,1,0} };
char ex_table[4][4] = { {0,0,0,0},
{0,1,0,0},
{1,0,0,0},
{1,1,0,0} };
void char_func();
void ex_func();
int power(int n);
//------------------------------------------------------
int main(){
int itr;
cout<<" Enter 1)The number of inputs\n\t2)Number of states ,and";
cout<<"\n\t3)Number of outputs \n of the sequential state machine \n";
cin>> N ; cin>> Q ; cin>> M ;
cout<<N ; cout<<Q ; cout<<M ;
char_func();
ex_func();
return 1;
}
//int CHARSSM[power(Q)-1][2*(N+M)-1];
void char_func(){
int itr,itr1,itr2;
char dummy;
int count=0;
cout<<"\n please write out the chrecteristic table of your flip-flop on a piece of paper";
cout<<"\n Iam assuming FF with 2 inputs and 2 states \n"; //I don't know if can be of different types too.
cout<<"\n The first two columns have been filled by the program ";
cout<<"in the order corresponding to q=0,q=1,q=2 and q=3 \n";
cout<<" Enter the third column of the CHARECTERISTIC table \n";
cout<<" Enter M for the memory state and T for toggle state\n";
cout<<" The order in which you enter the values is important\n";
for(itr = 0; itr < 4; itr++ ){cin>> dummy; char_table[itr][2] = dummy;}
for(itr1 = 0; itr1 < 4; itr1++ ){cout<<"\n";
for(itr = 0; itr < 3 ; itr++ ){count++;
cout<<" "<< char_table[itr1][itr];
}
}
cout<<"count = " << count;
cout<<"\n\n";
cout<< char_table[0][0] << char_table[1][0]<< char_table[2][0]<< char_table[3][0];
cout<< char_table[0][1] << char_table[1][1]<< char_table[2][1]<< char_table[3][1];
}
//----------------------------------------------------------------------------------
void ex_func(){
}
why is the output showing only the last column of the table??
puzzeled,
arjun