Hi there ,
i am writing my bachelor thesis and there is some C++ code attached to it.
I want to have a nice clean Project.
So what should be in it ?
I think :
Documentation in html ( generated with Doxygen)
README File
Makefile ( which make ? CMake ? )
Unit-Tests ( which unit test framework? )
Copyright Text ?
...
Did i miss some...
The digraphs represent finite automata. Up until now my test program has been writing out dot files for testing. This is pretty good both for regression testing (keep the verified output files in subversion, ask it if there has been a change) and for visualisation. However, there are some problems...
Basically, I want something callable...
I have a bunch of overloaded functions that operate on certain data types such as int, double and strings. Most of these functions perform the same action, where only a specific set of data types are allowed. That means I cannot create a simple generic template function as I lose type safety (and potentially incurring a run-time problem ...
Since i cant explain this very well, i will start with a small example right away:
template <class T> void Print(const T& t){t.print1();}
template <class T> void Print(const T& t){t.print2();}
This does not compile:
error C2995: 'void Print(const T &)' : function template has already been defined
So, how can i create a template func...
following code doesn't work with input:
2
7
add Elly 0888424242
add Elly 0883666666
queryname Elly
querynum 0883266642
querynum 0888424242
delnum 0883666666
queryname Elly
3
add Kriss 42
add Elly 42
querynum 42
Why my erase doesn't work?
#include<stdio.h>
#include<iostream>
#include<map>
#include <string>
using namespace std;
void ...
I know this probably really simple but Im not sure what im doing wrong...
The assignment states:
For the second program for this lab, you are to have the user enter an integer value in the range of 10 to 50. You are to verify that the user enters a value in that range, and continue to prompt him until he does give you a value in that r...
Hello:
I have implemented a Phong Illumination Scheme using a camera that's centered at (0,0,0) and looking directly at the sphere primitive. The following are the relevant contents of the scene file that is used to view the scene using OpenGL as well as to render the scene using my own implementation:
ambient 0 1 0
dir_light 1 1 1 ...
So I wonder how to get a streal from URL (with url_fopen for ex) (live video or PCM stream for example) and encode it into somsh?
...
I've got something like:
typedef struct Data_s {
int field1;
int field2;
} Data;
class Foo {
void getData(Data& data);
void useData(Data& data);
}
In another class's function, I might do:
class Bar {
Data data_;
void Bar::taskA() {
Foo.getData(data_);
Foo.useData(data_);
}
}
Is there a way to move the Data ou...
It is a compiler error or runtime error? The code below can be compiled!
class Base{
void g();
void h();
};
int main()
{
Base* p = new Base();
free(p);
return 0;
}
However it can't be compiled with a virtual function if I declare the class Base like this
class Base{
virtual void g();
void h();
};
The code below can be co...
I was doing a project for computer course on programming concepts. This project was to be completed in C++ using Object Oriented designs we learned throughout the course. Anyhow, I have two files symboltable.h and symboltable.cpp. I want to use a map as the data structure so I define it in the private section of the header file. I #i...
I'm wondering if anyone knows how to accomplish the following:
Let's say I have a bunch of data stored in SQL, lets say one of the fields could be called funcName, function name would contain data similar to "myFunction" What I'm wondering is, is there a way I can than in turn extract the function name and actually call that function?
...
A compiler cannot eliminate or reorder reads/writes to a volatile-qualified variables.
But what about the cases where other variables are present, which may or may not be volatile-qualified?
Scenario 1
volatile int a;
volatile int b;
a = 1;
b = 2;
a = 3;
b = 4;
Can the compiler reorder first and the second, or third and the fourth ...
I'm trying to write a program to test student code against a good implementation. I have a C++ console app that will run one test at a time determined by the command line args and a C# .net forms app that calls the c++ app once for each test. The goal is to be able to detect not just pass/fail for each test, but also "infinite" (>5secs...
I have to write my own hash function. If I wanted to just make the simple hash function that maps each letter in the string to a numerical value (i.e. a=1, b=2, c=3, ...), is there a way I can perform this hash on a string without having to first convert it to a c-string to look at each individual char? Is there a more efficient way of h...
I'm extracting files from zip and rar archives into raw buffers. I created the following to wrap minizip and unrarlib:
Archive.hpp - Used to access everything. If I could make all the functions in the other classes inaccessible from the outside, I would. (Actually, I suppose I could friend all the other classes in Archive and use privat...
Imagine I have a template function like this:
template<typename Iterator>
void myfunc(Iterator a, typename Iterator::value_type b)
{ ... }
Is there a way to implement the same thing by declare a typedef for Iterator::valuetype that I can use in the function signature? For example, I'd prefer to be able to do something like this:
tem...
I wrote a little program that solves 49151 sudoku's within an hour for an assignment, but we had to time it. I thought I'd just let it run and then check the execution time, but it says -1536.087 s. I'm guessing it has to do with the timer being some signed dataype or something, but I have no idea what datatype is used for the timer in t...
Hello,
I am writing a C++ server side application called quote of the day. I am using the winsock2 library. I want to send the contents of a file back to the client, including newlines by using the send function. The way i tried it doesn't work. How would i go about doing this?
...
So, I have two structs:
struct coordinate {
float x;
float y;
}
struct person {
int id;
coordinate location;
}
and a function operating on coordinates:
float distance(const coordinate& c1, const coordinate& c2);
In my main method, I have the following code:
map<int,person> people;
// populate people
map<int,map<fl...