I've created a solution who exported Access reports (graphics/tables) to a Word- and a PDF-format. Therefor I use PDFSharp and PDFFocus.
The PDF document is okay. But the Word-document looks good. Only the size of the Word-document, it has to send by e-mail, is much too big (17MB).
I have to open the Word document again to change the PageSettings to be sure, that the page-margins and the print orientation are correct.
using System; using Microsoft.Office.Interop.Word; namespace PageSetup { class TestPageOrientation { static void Main(string[] args)
[Code] .....
I don't know how it works in the Word-library source. But I've tried WdOrientation.wdOrientPortrait and once I was surprised. I saw this page in Landscape-format.
I think there is something wrong with my document sections, because the documents (with a lot of tables, graphics and a image) is much too big. And that's only after using this method.
So my next question is: How can I shrink the size of this Word document?
And what do I have to do to limit the amount of format-settings in this word-document?
#define ALLOCSIZE 10000 /* size of available space */ static char allocbuf[ALLOCSIZE]; /* storage for alloc */ static char *allocp = allocbuf; /* next free position */ char *alloc(int n) /* return pointer to n characters */
[Code] ....
The logic here I don't understand:
if (allocbuf + ALLOCSIZE - allocp >= n)
allocbuf is a char array allocated with 10000 positions. We add that to ALLOCSIZE macro which is 10000. Does that return a value of 20000? If so, it doesn't make sense to do this because all we had to do was this:
if (allocbuf - allocp >= n)
That takes length of allocbuf which is 10000 and subtracts allocp from it. So if allocp is 1000 we are left with 9000 available slots. And we can use that to check if we have enough to allocate n elements.
Is it possible to define a macro with in a macro? Any trick will do. I am trying to do quick conversion of cuda program to open mp by defining some macros at the top:
I have an array titled: char TypeOfSong[arraySize] where the array size is 15. I am reading data from a file into this array and the characters can be either 'C', 'D', 'E', or 'R'. Each of these characters stands for a word (sting) and when I output the array, I need the strings to show up, not the characters. I have been reading online and in my book but I can only find information on turning one array with the same characters into a string. How would I go about changing this character array with different characters into a sting?
If I have an array of two columns that have the same values and I want to change only the third column how can I go about doing this. The values of the third column will change based on the values in one of the columns which I plug into a math equation. Also how come I can't show a double value in the array?
#include <iostream> #include <math.h> #include<iomanip> #include <vector> using namespace std;
I have a 10x10 array, initialized to all zeros. I create 2 random numbers for the purpose of guessing a position in the array. However, when I print the array, the 0,0 spot keeps shifting to match the 2nd random number generated. Is there something strange about the 0,0 spot?
Here is my code:
Code: seedrnd(); for (x=0;x<2;x++) { randArray[x]=rnd(10); } for (x=0;x<2;x=x+1)
[Code] .....
The 2nd to last print statement actually prints randColumn. The last print statement correctly prints 0.
I want to write a programm that will reverse the order of the numbers in an array (e.g. as an input 1,2,3.5,4 and as an output i want 4,3.5,2,1) . But i have to problems:
1) I do not know how to properly change the type of a numbers inside an array from int to float or double, changing int to float in front of the a[10], does not change anything instead the code does not want to compile then.
2) I also want to make an array of a number of elements typed by a user with use of a "do" loop and how to put this parameter in the code.
Here is my code:
Code:
// ConsoleApplication3.cpp : Defines the entry point for the console application.// #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int a[10], i, n; int pom; do { printf("number of elements in an array a: n = ");
I have run across what I believe to be a syntax problem which I don't understand. I have a structure with two character array and I need to be able to change the size of those array dynamically. I have to use character arrays and I think the dot notation. I am not sure if I can use arrow notation. I can not do this problem using strings and vectors.
#include <iostream> #include <cstring> using namespace std;
I'm working on a homework assignment that asks me to roll two die a user given number of times, find the roll sums, and a few other things. I'm working on it one module at a time and I'm running into two big problems so far.
The first problem is that my int variable rolls changes to a number within the random number generator range of numbers after I run rolldie. I got around this by making a const equal to the user entered value of rolls just so that I could continue developing the program.
My second problem is that the values of the arrays resultsOne[] and resultsTwo[] are changed after running findsum(). Why this is happening and I even tried passing them as const, but that changed nothing. We just started learning about passing arrays to functions, so there might be something big that I'm missing.
Code: #include <iostream> #include <cstdlib> using namespace std; void rolldie(int resultsOne[], int sizeOfresultsOne, int resultsTwo[], int sizeOfresultsTwo); void findsum(int resultsOne[], int sizeOfresultsOne, int resultsTwo[], int sizeOfresultsTwo, int tossSums[], int sizeOftossSums);
Write a program using user-defined function which accepts an integer array and its size as arguments and assign the elements into a two dimensional array of integers in the following format: If the array is 1,2,3,4,5,6, the resultant 2D array is
I'm trying to put all of the words in a text document into an array but this text document is 2,138 kb, and when my program is crashing when I try to put it into an string array. Could the file be too big to put into the array?
int numbers[] = {8, 2, 0, 4, 100, 5}; for(int i = 0; i < sizeof(numbers); i++){ cout << numbers[i] << endl; }
However the results in the console is: 8 2 0 4 ,What am I doing wrong? Am I using the wrong built in function or something? I googled this and one of the links that came up stated to just do something like
arrayName.size()
but that didnt work for me either...
[URL]
Also, I know that I just enter the size of the list manually, in this case make i < 6 but I still want to know if there is a built in function or something.
I am trying to create a small set of filepath functions that I intend to compile across linux and windows (I prefer not to use a big library). I want to have a global constant PATH_SEPARATOR that depends on the OS environment. This is what I set at the top of header file.
Code:
#include <stdio.h> const char PATH_SEPARATOR = #ifdef _WIN32 ''; #else '/'; #endif I was hoping to test this while compiling this in a linux environment using gcc, thusly:
Code:
int main (int argc, char const* argv[]) }
[code]....
where apparently, I seem not to be able to "set" a part of the code to have "_WIN32" defined. I don't know if I explained this clearly.
I remember in C++, when a dynamic array is allocated, the size of this array is stored right before the array in memory. Therefore compiler knows exactly how long, when this array is deleted.
Do all compilers store the size this way? Is it a safe method to get the size of a dynamic array?
Here is a example code, it works fine on Visual Studio 2012.
#include <iostream> using namespace std; class dummy { public: dummy() { cout<<"dummy created"<<endl;
arrays with dynamic sizes. That being said, I'm working with a simple code which seems to work just fine, my only concern is that once I display the 'char array', not only displays the user's inputs but some extra data, symbols and what not.
why, if to my understanding the first user's input already sets the size of the array
#include <iostream> #include <iomanip> using namespace std;
char A[]={}; this is the array in c++ of unknown size, now I want to enter some alphabets via loop and want to be the no. of elements i entered the size of the array. .
I'm doing right now is creating a function that callocs (I prefer this to malloc) and returns a string, and it will work similar to printf, I'm calling the function alloCpy(),I have several values that I need in a malloced string, so I call Code: myAllocedString = alloCpy("Value 1 is %s, value 2 is %s, and value 3 is %d", str1, str2, num); To do this I'm using the Variadic Macro, the reason I'm not just using a Variadic Function such as this: Code: char* alloCpy(char *format, ...) {} is because I need to append NULL to the end for the sake of looping through arguments, and I'm understanding it thusfar, but I have a few issues, first of all, I tried defining the Macro in a header file, but when I try to call it I get the error "Undefined reference to alloCpy". Also, to loop through arguments to get string lengths I'm using va_arg(args, char*) which requires all the arguments to be of type char*. Here is my code: myheader.h:
So, how can I do this to, first of all, make my macro function accessible from other files importing myheader.h, and second, how can I make it accept any type of argument like printf, so that my example above would work?
Code: #define FOO BAR #if FOO == BAR doX(); #else doY(); #endif
This causes doX(); to be executed. But the intent is to have doY(); be run. I'm guessing this is because BAR is undefined and therefore blank, so blank equals blank. Is there some way to compare the symbol FOO was set to instead of its value, BAR?