i'm right now using C, IO is done via ncurses, but that won't affect the following problem, i think. The relevant code is:
#define SIDEBARWIDTH 27
//...
typedef struct {
[Code]...
surprisingly this works, now the new 3rd outputline is correct again. So it seems that the printcommand has some troubles with accessing the struct here. Not sure if that might be ncurses fault. Still feels odd.
I just dont see what the issue is here. I have stared at this thing forever. Im trying to make a calendar from scratch so I can be prepared for my second test on Friday.
Code: #include<stdio.h> #include<stdlib.h> int main(void) { int i, n, s;
#include <iostream> #include <string> using namespace std ; int main() { string bored ; do { cout << " program" <<endl ;
[Code] .....
I made this as a simple do/while program, and if i run it, the second do/while statement will keep on going forever, without the [cin >> bored;] line working?
I've implemented it a bit differently: I create 2 temporary arrays, one for the numbers lower from the pivot , an done for numbers greater then the pivot. in the end of each iteration the 2 arrays are copied to the original array:
Code: #include <iostream> void QuickSort (int* A , int start, int end){ if (end-start<3){ return; } int mid=(start+end)/2; int pivot=A[mid]; int lA[end-start] , rA[end-start], rCounter=0,lCounter=0; int curr=0,i=start;
I am trying to release my C++ app to run on desktops that dont have VS installed and have created an install shield app to install on the desired computer. my issue is even after packaging it, it still requires certain DLL's...I read online that I had to copy 'msvcr120.dll' and a few others to syswow64 and sys32 folders but now when I try run my app it just crashes before starting.
I think it sucks that Microsoft no longer packages required DLL's like it used to in 2010.
Ive been having a hard time creating bin file. Whenever I append data, the data wont show in browse function. And this program works good without the bin file code.
my text for the score and difficulty doesn't seem to work. They are both appearing twice and not updating. The score text worked fine until I inserted the difficulty text and I can't seem to find the problem. URL.....
I should reduce the number of bitmaps I used in my code. I translated my particle engine into code that could be compiled as plain standard C
Currently, the code has a segmentation fault somewhere that I can't figure out. How it should function is that it takes orders from a queue for new lasers to store the instances in a linked list. It then takes that data and updates its coordinates, one node at a time. The first node should also be the first node to complete its life, so it gets removed, and the list is set to the next node in memory. If there are no more nodes left, a if-statement should catch it and either break the current loop, or wait for more items to be requested. If there are nodes left, the process will continue to remove the first node in the list until there are none left. Obviously this is not quite how it works. When I tested in once in SDL, the laser would update every 5 frames, but wasn't shown constantly, and would crash after the node was to be disposed of. When I initialize with the SDL parachute, it would exit before I event saw the screen. Also, the code I translated to standard C will display that the laser has been updated to the screen, but it never says that it has moved up. It crashes after about 4 printf() statments execute. My debugger has been giving me mixed SIGTRAPS, and "nothing is wrong" output. Here is the code in standard C:
Im about to program a RPG and, of course, the player has got an inventory. The items in this inventory are stored in a linked list and have IDs in form of strings.
player.cpp: (just the most relevant)
#include <list> #include <string> using namespace std;
[Code] ....
Of course, when the player saves the game, the inventory has to be saved too.
game.cpp(just the m. R.) #include <fstream> using namespace std; class CGame{
[Code] .....
Now, in my code I write the linked list into the file savegames.sav
I realized a Matrix class to practice and I have a problem I can not solve! Here my problematic code:
Mtrx.h:
Code: template <class T> Mtrx::Mtrx(dim m, dim n, const bool random_constructed = false, const T min = static_cast<T>(0), const T max = static_cast<T> (10)) Mtrx.C
[Code] ...
And here the relative main section:
Code: Mtrx rand1 ( 5, 5, bool);// ok cout<<rand1<<endl;
Mtrx rand2 ( 7, 3, bool, -5, 20);// ok cout<<rand2<<endl;
Mtrx rand3 ( 7, 7, bool, 0., 15.);// compilation error: undefined reference to // "Mtrx::Mtrx<double>(unsigned long, unsigned, bool, double, double)" // collect2: error: ld returned 1 exit status
I wrote a program with function my own function which count the digits of entered number. The problem is whatever i type it shows 0 digits.Why is that?
Code: #include <iostream> using namespace std; int cikCipari (int skaitlis, int cipars); int main()
I installed FLTK 1.3.X from [URL] on my visual studio 2012 compiler and use PPP book for C++ programming [URL]. My problem is about filling a Shape in.
Code: #include <Simple_window.h> using namespace Graph_lib; int main() { Simple_window win(Point(100,100), 1000, 600, "Binary_tree"); Graph_lib::Circle c(Point(200,200),50); c.set_color(Color::red);
[code]....
When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?
I'm working on a project that requires to make modifications to certain functions. So, I'll copy and paste the function to a new source code so I'm just working on the function with the entire program running. When I run the function by itself, it works fine. But when I copy and paste the function back to it's spot, the program doesn't wait for input at the cin.getline & it did wait when I ran just the function by itself. I'm using Dev C++ if that makes a difference.
I have a WPF DataGrid with DataGridTemplateColumns, when I select rows and use Ctrl+C, and then in Excel or any document Ctrl+V, no data is pasted. If I change columns to DataGridTextColumn then copy and paste works fine. What can I do to make work copy & paste with DataGridTemplateColumn? Also when I set ClipboardContentBinding="{Binding FirstName}" for the template column, Null Refrence exception is thrown.
So, I have spent the last week looking googling and researching how to get a standalone copy of the regex part of the boost library to work in a project. This project will be compiled on other machines and I CANNOT have the user install it.
Is there any way to do this?
So far, I have built the regex part: I have both .so files and .a files built. The thing that I'm unsure of is that these were built with gcc and I am using/will be using g++.
I have also finally got the bcp tool to work, and extracted the regex part and all of its dependencies.
I can't get it to compile any way I try to work it. I need this to be in a folder "regex/" folder in my directory.
I have used too many commands to paste them all, but the last I tried was this:
I have also tried many variations of the above command. Such as using -lboost_regex and lots of other things. Is my whole problem because I'm using an .so built by GCC?
The output of the above command was
/usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_allocate_exception': (.text.__cxa_allocate_exception+0xb4): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_allocate_exception': (.text.__cxa_allocate_exception+0x111): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_free_exception':
I'm trying to serialize a struct which contains two or more other types of sturct. But it seems that serialization does not work. Below is sampel code :
I am trying to change the value of of time in my vector of structs. The result should output 1430 as the value of shares[1].time though I get something different.
puts(pd) does not give any output in the below code. Also, the first puts(ps) does give an output, but the second puts(ps) after "while" does not give any output.
Code:
#include <stdio.h> int main() { char source[50]="Alice has apples."; char destination[60]; char *pd, *ps; }
I am trying to copy a string to an array of string. I have used these two examples before and they have worked so I don't understand why they won't work this time. I am getting a segmentation fault.
[URL]... [URL]...
I remembered to initialize everything.
char *strings_mneumonic_table[503] = {0}; char mneumonic[20] = {0}; int start_address = 0; int hash = 0; if(line[0] == 32)
[Code]...
Here is my output
hash is 2 little start BIG START 32 group mneumonic is START hash is 2 Segmentation fault (core dumped)
Copy some characters from char * arg to char * first using a loop with specific conditions.
Code:
char * arg; // set arg some string... char first_[25]; char * first; int length; length=strlen(arg); for (n++; arg[n] != '}' || n>=length-1; n++) strcpy(first,arg[n]); // first += arg[n]; I have strcpy(first,arg[n]); but arg[n] is char and strcpy expects char * ;
My goal is to copy only the elements of string 2 that are equal to string 1 into a new string. I tested this idea with an array of integers and it worked, but didn't work for the strings.
Code:
#include<stdio.h> main() { int scan1; char arr1[40] ; char arr2[40] ; char arr3[40] = {'_',.....,'_'}; /*for sake of brevity with post*/ }
#include<iostream> #include<string> using namespace std; int main(){ char char_array[10]; int ascii_array[10];
[Code] ....
I have been trying for a while to copy a string to an array, i know i can copy an char_array element to a string but its with a two dimension. How can i do this? i want it to be user entered.