Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 12-01-2009, 12:22 PM   #1
Beta Member
Join Date: Dec 2009
Posts: 1
Default Translate program from C++ to Pep/8

This is problem 13 out of book Computer Systems by Warford fourth edition. I am suppose to translate this C++ program into Pep/8

#include <iostream>
using namespace std;

int maint(){
char ch;
cin >> ch;
if((ch >= 'A') && (ch <= 'Z')){
cout << 'A';
else if((ch >= 'a') && (ch <= 'z')){
cout << 'a';
cout << '$';

cout << endl;

This is what I have but it keeps printing out $

BR main
ch: .EQUATE 0
main: CHARI ch,d
LDA ch,d
if: CPA 'A',i
BRLT elseif
LDA ch,d
CPA 'Z',i
BRGT elseif
STRO msg1,d
BR endIf
elseif: LDA ch,d
CPA 'a',i
BRLT else
LDA ch,d
CPA 'z',i
BRGT else
STRO msg2,d
BR endIf
else: STRO msg3,d
endIf: STOP
msg1: .ASCII "A\x00"
msg2: .ASCII "a\x00"
msg3: .ASCII "$\x00"
S2009 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 06:01 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0