Skip to main content
gamedev.net
🔒 Locked

A Non-Return-Zero

Started by kingoftheday 0 replies 150+ views
Original Post
kingoftheday
kingoftheday
Please help me to fix this program. What I am trying to achieve are: a) NRZL (Non-Return-Zero) b) NRZI (Non-Return-Zero) c) RZ (Return-Zero) d) Manchester e) Differential Manchest I wish I can use graphic function on C++ to achieve this, but I don''t know how to use it. I will appreciate it, if you can use graphic to achieve my aim. Thank you very much. This is urgent. Below is my code. #include #include #include #include #define ARRAYSIZE 12 void NRZL(void); void NRZI(void); void RZ(void); void Manchester(void); void DifferentialManchest (void); int x, n, R[ARRAYSIZE]={0}; int main() { cout << "Enter 10 binary digit number \n"; for(n = 0; n <= ARRAYSIZE-1; n++) cin >> R[n]; clrscr(); cout << endl; for(n = 0; n <= ARRAYSIZE-1; n++) cout <<'' ''<< R[n] <<'' ''<< '' ''; NRZL(); cin >> x; } void NRZL(void) { int x; cout << "\n NRZ-L" << endl; for(n = 0; n <= ARRAYSIZE-1; n++){ cout << '' ''; if (R[0] ==0) cout << "----"; else cout << "____"; for(n = 0; n <= ARRAYSIZE-1; n++){ if((R[n]==0) && (R[n-1]==0)) cout << "----"; if((R[n]==0) && (R[n-1]==1)) cout << "|---"; if ( (R[n] ==1) && (R[n-1] ==0)) cout << "|----"; if ( (R[n] ==1) && (R[n-1] ==1)) cout <<"____"; } } NRZI (); cin >> x; } void NZRI(void) { cout << endl; cout << "\n NRZ-I" << endl; for(n = 0; n <= ARRAYSIZE-1; n++) { cout << '' ''; for(n = 0; n <= ARRAYSIZE-1; n++) { if(R[n] == 1) cout << "|---"; else cout << "----"; } } cout << endl; RZ (); } void RZ(void) { cout << endl; cout << "\n RZ" <> x; }

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.