C++ :: Compilation In Machine Language
Jan 25, 2013
Have a program which given a C source code file, gives back RAW MACHINE CODE, which means it doesn't have to be a executable on his own.
Like:
Given a example function for C:
int stdcall Function(void)
{
return 0;
}
Gives back the Machine Code for the Example Function.
It doesn't need to be actual C code, it can also be like:
type int
return 0
Or also it can be a straight assembly-to-machine-code compiler.
Is there any Library? Or even a external tool I can look into?
View 4 Replies
ADVERTISEMENT
Jul 23, 2012
I have a COM exe which runs fine on all machines that I have used except one. On a particular machine, the COM exe does not start even after trying to execute it manually (do a double click on the file from explorer).
There are no error messages as well. what could be happening ?
View 8 Replies
View Related
Jul 10, 2014
My need is that i need to design a program for a machine. The machine takes "x"qty of load, refines 30% of it and sends back the 70% to the initial position. after how many times, does the qty of the load refined will be equal to the initial load and how many times does it need tot be refined?
View 1 Replies
View Related
Sep 25, 2013
My group's chocolate vending machine code is clean, but has a problem.
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
// Variables from function "chocoSelect".
[Code] ....
The functions doesn't seem to link in proper. Also, for the "chocoSelect" function, if a user enters a selection number other than 1 to 5, the machine will stall and wait for 10 seconds to try again. How?
View 11 Replies
View Related
Apr 20, 2013
I am making a finite state machine for a lab. I have here a 2 files with the code for the FSM. I know it isn't finished yet, I know what needs to be put in. The only things I would need help on are the errors that I get.
Warrior.h
#ifndef _WARRIOR_
#define _WARRIOR_
#include "State.h"
[Code]....
View 1 Replies
View Related
Apr 2, 2013
i am just making some new programmings and testing it. But every time after compile and run The dos window is closing and again I have to compile And run command so i want The dos windows should prompt me for next input rather than closing.
View 2 Replies
View Related
Feb 5, 2015
I have a problem with compiling the Allegro5 library:
"Cannot find allegro-5.0.10- monolith.mt"
source:
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <cmath>
int main() {
al_init();
al_init_primitives_addon();
al_install_keyboard();
ALLEGRO_KEYBOARD_STATE klawiatura;
[Code] ....
View 1 Replies
View Related
Mar 28, 2013
Write a program that simulates an adding machine. When a zero is entered it should print the subtotal of all the numbers entered from the last zero that was entered and reset the subtotal. When two consecutive zeroes are entered it should print the total (not the subtotal) of all the numbers entered and terminate the program. Example:
1
2
3
0
subtotal 6
4
5
-2
0
subtotal 7
8
0
subtotal 8
0
total 21
Be careful this program needs a bit more thought than you might think at first. To get full credit you must make sure it also works for the 0 - 0 case. Example:
0
subtotal 0
0
total 0
The problem is, after I enter the integers and type 0, it shows the subtotal which is what I want; however, when I type more integers and type another 0 to see the subtotal again, it shows the total instead. The subtotal should reset whenever a single 0 is typed and the total should only show when two 0's are inputted simultaneously. Also, after the user enters two 0's simultaneously and views their total, I want the program to exit by saying "press any key to exit." Is there a special name for that to happen? Here is my code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int subtotal = 0, total = 0, number = 0;
bool input_zero = false;
[Code] ....
View 2 Replies
View Related
Apr 23, 2014
This is my code so far and in my else if statements its sayin "Expected Primary Expression Before "Else"
What do i do?
#include <iostream>
using namespace std;
int main () {
//declare variable
double n,a,b,c,d,total;
[Code] ....
View 3 Replies
View Related
Oct 25, 2014
I have part of it done but im not sure how to get my amount balance to get into my other functions from my file...
#include<iostream>
#include<fstream>
using namespace std;
void welcomeUser();
bool readFile();
void menu();
[Code] ....
and the amount saved that I have in the file is 1200
View 14 Replies
View Related
Nov 19, 2014
Is there a way I can extract Machine / Hardware ID and OS Version using VC++?
View 3 Replies
View Related
Oct 3, 2013
i'm student in computing science , i want to specialize in IT security and the first step i think is to know how to program a virus and understand how it works and how to stop it now i'm just a beginner I look for a way forward , i need some tips where can i begin? What are the basics of IT security? What programming language should I learn?
View 3 Replies
View Related
Jun 15, 2013
Q. In context of C language syntax checking, which of the following can be modeled using Finite Automata?
(A) Detecting proper termination of an instruction.
(B) Detecting balance of parentheses.
(C) Detecting initialization of a variable.
(D) None of the above.
View 4 Replies
View Related
Dec 18, 2013
I have to communicate between two laptops using USB-to-Serial adapter. I have written 2 programs one for sending and another for receiving. Programs were written in both C and C# programming languages.
Using C language: I am able to successfully communicate using C-Programs mentioned below. But the problem is speed. It takes around 1 hour(60min) for just to pass 150MB. improving the performance of this programs...I also mention some comments along with programs for self understanding.Sender File on laptop with serial port :
Code:
#include <stdio.h>
#include <bios.h>
#include <conio.h>
}
[code]....
The above 4 programs behaves as, sender send a character and receives an ack for every character. I have followed this approach, bcoz other approaches were not working fine (in the sense the complete data is not sent, the amount of data sent is not judgeable, bcoz it will different every tym). when i used this approach it worked fine.
View 6 Replies
View Related
Dec 11, 2014
I'm supposed to create a circular buffer that reads an input file and outputs data after running though basically an integral equation. Everything my be referenced by pointers. When I build I am being told segmentation fault: 11. From what I have gathered that means there is a problem with my memory allocation correct? I'm including the custom header file and the main.c as well.
header file :
#ifndef FSM_H
#defineFSM_H
#define INPUT_BUFFER_LENGTH 2
#define OUTPUT_BUFFER_LENGTH 2
#define INITIAL_INPUT {0,0}
#define INITIAL_OUTPUT {0,0}
[Code] .....
View 1 Replies
View Related
Apr 9, 2013
Code:
class A
{
public:A(int a, int b);
};
I need to have an object of class A that doesn't have a default constructor in another class, B:
Code:
class A; //This is in a separate header file
class B
{
private:A a;};
The problem is that it won't compile without a default constructor. I'm not allowed to define a default constructor, and the A object in class B has to be private so I can't initialize A a in public.
I also can't change the prototype in the interface to something like
A(int a = 0, int b = 0);
since one of the requirements is that if an object of class A is declared in main, it must not compile due to not having a default constructor. So what can I do to make class B work and compile?
Another question I have is why is this valid:
Code:
class A; //#include "A.h" is in the implementation file so it compiles.
class B
{
private:A* a;}; But not this: Code: class A;
class B
{
private:A a;};
This is for a project that I probably won't be able to turn in on time, but I care more about how to do this right than turning it in for full points.
View 4 Replies
View Related
Oct 17, 2013
main:
#include <cstdlib>
#include <iostream>
#include <fstream>
#include "Board.cpp"
int main(int argc, char* argv[]){
argc=5;
argv[argc];
[Code] .....
I can't find a place where there are two definitions of any of the Board methods
View 9 Replies
View Related
Sep 6, 2013
how to open an audio file using c. write a code to open an audio file.
View 2 Replies
View Related
Nov 15, 2013
The goal of my program is to convert a decmial number to a binary number.First, the program gets an input to an array of chars, and the function translate_dec_bin converts this array to a decimal number through the strtoul function.The problem is that my program prints the binary number with an additional "0".For exmaple, for the input 1 - the program prints 01 instead of 1, for the input 3 - the program prints 011 instead of 11.
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX_LEN 20
void translate_dec_bin(char s[]){
char st[sizeof(unsigned)*20] = { 0 };
}
[code]....
View 2 Replies
View Related
Mar 13, 2014
I have a problem about compiler.I want to write a simple compiler for a language.
stm -> id := expr
| print expr
| if expr then stm
| while expr do stm
| begin opt_stmts end
[Code] .....
I guess I should create main.c to convert source code.Also,I should create a source.c to write a example program that is relevant with above grammar.
View 1 Replies
View Related
Sep 27, 2014
I have a program that reads a text file and then outputs the corresponding transition table according to the regular expression given in the text file. The first line that is read by the code contains the transition table. The subsequent lines of the text files include the strings. I want my code to read the strings in the subsequent lines of the text file and tell me whether the string is accepted or not by the language. Basically, what my code does is that it translates the regular expression to an NFA and then, it translates the NFA to a DFA and then it builds a transition table according to the language.
I have included a special library in my code and I compiled my code from the command line using the following command:
gcc -o lalab lalab.c -lncurses
then, I just run the program like this:
./lalab
Another problem that I have is that my code does not handle the empty transitions, so the program should output a corresponding result when it is fed a regular expression such as a|e. The alphabet of the language is made of {a, b, e} e is the empty transition. The text file that the program reads from includes a regular expression in its first line and strings to be accepted or not in the following lines. Given an input file like this:
(a|b)*a
aaaa
aba
bba
ab
bbb
:frown:
The code should produce an output like this:
yes
yes
yes
yes
no
no
Code:
#include<stdio.h>
#include<conio.h>
#define MAX 20
//=========================================================
struct nfa_state {
int a, b, eps1, eps2;
}NFA[20];
[Code] .....
View 8 Replies
View Related
Oct 19, 2014
Program:I have 2 arrays: 1 for the correct answers to a quiz, 1 for the user. I then have a vector to hold the incorrect answers.
It keeps outputting what looks like alt characters, why.
Here is the code:
#include <iostream>
#include <vector>
using namespace std;
int main() {
const char a1[]={'a','d','b','b','c','b','a','b','c','d','a','c','d','b','d','c','c','a','d','b'};
char a2[20];
int i=0;
int incorrect=0;
[code].....
View 1 Replies
View Related
Nov 25, 2012
Running c in jgrasp.. i am getting error has gcc not found.
View 4 Replies
View Related
Dec 28, 2014
I've recently started creating a bingo caller application. I need in changing numbers to different text boxes. When a number is called it will be displayed in a text box and the last four numbers previous to that. However the oldest number needs to delete and for the remening numbers to move when a new number is called.
View 2 Replies
View Related
Dec 26, 2013
I want to store values permanently in a variable. The same variable should be able to be edited and saved by user, and whatever it is I need the value of the variable from the last time I modified it, like a database. database because i need this to set my connection string of the database.
View 1 Replies
View Related
Jul 5, 2014
Considering this small code:
Here a template array class is written and also a cat class. The cat class has "present" method.
the array is initialized with 20 cats. yet, trying to activate a cat methods makes a compilation error:
Code:
#include <iostream>
using namespace std;
template <class T>
class Array{
private:
[Code].....
how do we make it work? I'm sure there's a way I'm not aware of since if we can't - what is the point of templates?
View 6 Replies
View Related