For class we are required to implement a signature block on all our assignments. To do this I've created a Signature Block class, but I'm having trouble implementing it. When I try to compile in Dev C++ I get this error:
[Error] request for member 'toString' in 'myblock', which is of non-class type 'SignatureBlock()'
Here is the code:
Assignment1.cpp
#include <iostream>
#include <string>
#include "SignatureBlock.h"
// Assignment 1: Requests user's name and says "Hello."
using namespace std;
int main(int argc, char** argv) {
string name;// string to store user's name
SignatureBlock myblock();// create a signature block object
And the following program that displays block by block:
StreamReader streamReader = new StreamReader("G:LAB123LABWORK2.txt"); int block = 0; while (!streamReader.EndOfStream) { string line = streamReader.ReadLine().Trim(); if (line.CompareTo("") == 0)
[Code] .....
My problem is am supposed to add a verification code so that if i put a string e.g 1:?:? it returns the block where the string is found and gives of all possible answers.
I have a Point class that's already implemented. My goal is to implement a container class called Line that holds the Point class. I'm not allowed to use any existing container classes for this. Here's what I'm working with:
//File: Point.h #ifndef POINT_H_ #define POINT_H_ class Point { public: Point(int x = 0, int y = 0); Point(const Point & t); virtual ~Point() {};
[Code] ....
How I'm supposed to write Line.cpp...how do I access/add Points to Line without using something like a vector? I probably should've included what I've written so far.
#include "Line.h" /** * Default Line constructor */ Line::Line() {
The following program is designed to demonstrate class templates. The program will evaluate postfix expressions input to the console by pushing them in a stack, and then popping them and evaluating them as such, (ex. entering 3 4 + would equal 3+4 = 7).
The code is below. We are not to modify it, but to fill in the blanks, the places filled in indicated with two asterisks for a line, and one on each side for a part of a line. If I didn't know what to enter (if anything), I put three ?s. If you want to copy and compile for yourself, look for all the *s and ?s.
1) I'm turning up all sorts of errors in the main program file (prog5.cpp) having to do with stacktype.cpp. It has been removed from the program, as it is included at the end of stackType.h. Most of them are "cannot convert 'this' pointer from StackType to StackType<stack> &'. How do I fix that?
2) The program supposedly lacks a default constructor, and it keeps turning up that 's' is an array of unknown size (do I call StackType or stack or what?).
stackType.h Code: #pragma once// Catherine Stringfellow and Trey Brumley // A Stack is a data type, which stores values in an order where values are added to the top of the stack when pushed, // and when popped, remove and return the value from the top of the stack. // Class specification for Stack ADT in file StackType.h using namespace std; static const int MAXITEMS = 50;
So this code compiles without any problem but it is not producing the correct output. I know there's a problem in either my getBlock or putBlock functions but I can't see it.
Currently the output is "Should be 32 1s: " "Should be 32 2s: "
There should be 32 1s and 32 2s and nothing is coming out.
#include <iostream> #include <fstream> using namespace std; class Sdisk { public : Sdisk(string diskname);
The function im having problems with takes an array where each element is an array of unsigned chars i.e. octals representing a bitmap of one of 95 ASCII code characters and searches through this two dimensional array looking for a match for a predetermined of array of unsigned chars i.e. the bitmap of a predetermined char. If we find the char the function outputs the index in the two-dimensional array where each elem. is an array of octals ELSE it return -1 i.e. when the char is not found.
I have 2 files, one .cpp, the other .h. There is a function named find_char. See INPUT and OUTPUT on line 48 in .cpp file.
The exception im getting is: font2.cpp:23:45:error: invalid conversion from unsigned char to unsigned char(*)[5]
The input type specified for my function prototype corresponding to find_char. If I put just unsigned char it doesn't fix the problem because it's an array parameter i.e. like a call by reference. I've lead myself to believe that the array variable contains a pointer to the first value in the array and so I've made function prototypes that work with a T* i.e. a pointer to type T. Making the function prototype argument unsigned char* i.e. a pointer to unsigned char simply gives me the exception: "invalid conversion from unsigned char to unsigned char*". When I have the argument be 'unsigned char' I get undefined reference to find_char(unsigned char). URL.....
I want to know how to list the all the symbols in the shared library(dll or .so file). I dont want commands like nm or objdump or depends.exe . I want to get the list of functions available in shared library programmatically at runtime (after calling loadlibrary/dlopen and GetProcAddress/dlsym). Is there a way to get the complete signature of functions in a shared library?
I would like to define a templated class while implementing default value on templated arguments. I don't know how to do that with string templated variables.
For exemple:
Code: template <class T> class A { public: A() { version = ???? } std::string_base<T> version; };
I don't want to pass the default value as parameter of the constructor. how I can do this?
Here's my program bake.cpp(name does not reflect content) I've been researching this binary error and haven't been able to find a solution...
Code: #include "stdafx.h" #include <iostream> #include <string> #include <conio.h> using namespace std; int main() { //Display a list of options. cout << "Choose your favorite:" << endl; [Code] ....
Error code..
1>------ Build started: Project: bake, Configuration: Debug Win32 ------ 1> bake.cpp 1>c:usersjonbecherdocumentsvisual studio 2012projectsbakebakebake.cpp(41): error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::basic_ostream<_Elem,_Traits>'
I start working on CodeBlocks and stuck in a situation. The situation is that I want to clear my output screen every time the main function calls some other functions. To do that I use clrscr() function but its not working. After spending some times on web, I found that its a non-standard function so this extension is not used by the new compiler's. Another thing I find to use < cstdlib > library. But unfortunately it do works only for C. It works for C++.
I have a program that I can only run one instance of. When I try to start it a second time, it doesn't do anything. I would like to create a script that loads the program in a way that I can run multiple instances. Since I assume the program checks the process tree on startup to see if an other instance is already running, I figure disabling access to the process tree could do the trick.
I just want my program to run continuously until someone enters 0 to exit it. I tried doing while(x=1) and looping my entire block of code. Also there is a switch one is a for one is a while loop both doing the same function. I have basic error checking and whatnot.
/*This is a program that gets a user to input a starting and ending value. The code then prints the number ie 1 and 5 would be (1,2,3,4,5) and all the squares and cubes. There is a case statement asking weather you want to run it as a for or as a while loop. The choices are case sensitive. */
#include <stdio.h> #include <stdlib.h> #include <math.h>//allows for power and cube function int x; int main(){
I have a program including several code blocks in the following simplified structure:
int main() { // block A if(a > 0) { }
// block B if(a > 1) { } }
Block A and B should be executed separately, according to entry from keyboard. For example, if entry "1", block A will be executed and block B will be ignored; if entry "2" the inverse will happen.
I can control the execution of these two blocks through macro but the code will be separated during compilation. But is there a way to control them without using macro?
I am working on a program that does something like this,
Void main() { cout<<"H";timedelay(1); cout<<"E";timedelay(1); cout<<"L";timedelay(1); cout<<"L";timedelay(1); cout<<"O";timedelay(1); //timedelay(int a) is a function which gives a delay of 'a' seconds. { .... } }
This code is just for fancy and I would like to squish in some statements which would give the user an option to skip it (by entering any keyboard key),and resume with the rest of the program.
I am designing an application in which I need to deal with many different variables in which different sequences of bits are stored. I have very strict memory requirements so I decided to use the boost::dynamic_bitset data type which works very well in my scenario as I need to dynamically allocate/deallocate/resize the variables.
The only problem is that I am not able to change the size of the blocks in which the dynamic_bitsets are stored.
I mean, even if I specify the blocks should be "unsigned char", I always obtain 32 bytes allocation by sizeof function, even if the variable is empty.
How to print a year like DIGITAL CLOCK NUMBER for any input four digit number ...
For example if input 1000 the output should be 1000 but each number should look like this in the block form for example number 0 is, don't mind those stars, i did not know to print it here, that is number zero ...
Suppose, I have point_c, line_c and block_c three classes:
class point_c { public: double x, y; };
class line_c { public: vector<point_c> Pt;
[Code] ....
As you can see, lines are composed of many points, and blocks are composed of lines and points. And I defined some member functions, so that I can add points or lines as required by line and block.
But, here comes the problem, if I use line.insertPoints(), or block.insertPoints(), the points will be stored in line or block. That is not what I want.
I want have a single place to store all points, a single place to store all lines, and a single place to store all blocks.
class point_c { public: double x, y; }; class line_c { public: vector<size_t> PtIndex;
[Code] .....
in this way, the member functions will create the real entities into the global vector and set an index pointing to that entity. But this approach just make me feel it is not OOP anymore. when people using these classes, they got be careful about the global variables.
So, I'm attempting to create a grid on the screen, and to do so, I've implemented a multidimensional array of Rectangles. When the program starts, I use a for loop to increase the x and y coordinates to form the grid.
public Form1() { InitializeComponent(); for (int x = 0; x < 12; x++) { for (int y = 0; y < 12; y++) {
[Code] ....
My issue is trying to figure out when the user has clicked on a rectangle, and furthermore, which rectangle in the array that he/she has clicked on. As I will change the border to red when given the correct rectangle.
I'm using Visual Studio 2008, and here is my code so far.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;
[Code] .....
I'm making this into a real game, with classes and all.
I am using new operator, I don't recall what the allocator's name is. But what is the corresponding Exception (or derived classes) any try-catch block can cope with?
I'm working on a program which creates data and saves it into blocks (different files), then reloads and converts it all. the .ftl file saves properly, but for some unknown reason, it won't let me open it for input after.
setblock will typically = 3, but for testing purposes is set to 1. this really has me confused. the compiler i'm using is Dev-C++ 5.2.0.1 on xp. i have tried pausing the program after the output file is closed, confirming the file has been created in the proper directory before continuing but still fails the .is_open() check.