Showing posts with label Programming ASM. Show all posts
Showing posts with label Programming ASM. Show all posts

Monday, January 18, 2016

Solved UVA problem (code for bad horse using c/C++ programming)


using namespace std;

class Node{
public:
    string name;
    vector adj;
    bool visited;
    int groupId;

    Node(string str):name(str), visited(false), groupId(-1){}
    int getNeighborCount(){
        return adj.size();
    }
};

class graph{
public:
    unordered_map hashNode;
    vector nodes;

    void createNode(string str){
        Node* n = new Node(str);
        nodes.push_back(n);
        hashNode[str] = n;
    }
};

int main()
{
    freopen("A-small-practice-1.in", "r", stdin);
    freopen("A-small-practice-1.out", "w", stdout);
    int input_count;
    cin>>input_count;
    int counter = 1;
    while(input_count)
    {
        int M;
        cin>>M;
        graph G;
        for(int i=0;i        {
            string str1, str2;
            cin>>str1>>str2;
            g.AddEdge(str1,str2);
        }
        cout<<"Case #"<        input_count--;
    }
    return 0;
}


Friday, January 31, 2014

Assembly Language Program: Display a character and read two decimal digits and summation of some integer number

.model small
.stack 100h
.data
s1 db 'ENTER TWO NUMBER WHOSE SUM IS LESS THAN 10: $'
S2 DB 0AH,'THE SUM OF $'
S3 DB ' AND $'
S4 DB ' IS $'
A DB ?
B DB ?
C DB ?

.CODE

MAIN PROC

MOV AX,@DATA
MOV DS,AX

MOV AH,9
LEA DX,S1
INT 21H


MOV AH,2
MOV DL,0AH
INT 21H



MOV AH,2
MOV DL,'?'
INT 21H


MOV AH,1
INT 21H
MOV A,AL




MOV AH,1
INT 21H
MOV B,AL


MOV AH,9
LEA DX,S2
INT 21H

MOV AH,2
MOV DL,A
INT 21H

MOV AH,9
LEA DX,S3
INT 21H

MOV AH,2
MOV DL,B

INT 21H


MOV AH,9
LEA DX,S4
INT 21H

SUB A,48D
SUB B,48D
MOV AL,A
ADD AL,B
MOV C,AL

ADD C,48D



MOV AH,2
MOV DL,C

INT 21H

MOV AH,1
INT 21H

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN