comandoprint.cpp

来自「"tiny" language interpreter written in j」· C++ 代码 · 共 42 行

CPP
42
字号
/*
TP2 LP INTERPRETADOR TINY
ALUNO : ANDRE LUIS DURAO ABDO
MATRICULA : 283999
DATA DA ENTREGA : 10/05/2007
*/ 

//ComandoPrint.cpp
#include "ComandoPrint.h"

ComandoPrint::ComandoPrint(const string& str,bool tipo,Memoria *mem,int linha){
    //tipo define se o print e de strings ou de variaveis na memoria
    //tipo == true ->string 
    strMem = str;
    tipoOp = tipo;
    this->mem = mem;
    //seta linha no vetor de execucao
    this->linha = linha;    
}


int ComandoPrint::executa(){
    if(tipoOp)
        cout << strMem;
    else{
        string *temp = mem->getValue(strMem);
        cout << *temp;
    }
    return (linha+1);
}

string ComandoPrint::toString(){
	string saida="";
	if (tipoOp)		
		saida = "print ('"+ strMem+ "')";
	else
		saida = "print ("+ strMem+ ")";
	return saida;
}	
void ComandoPrint::defineLinhaSalto(int nolinha){
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?