C# :: Picture Cropping Code Causing Error In Main Program
Jan 24, 2014
Ok, this thing works as far as the getting the image and drawing the rectangle but for the life of me I cannot figure out why it is causing an in the program.cs.
public partial class Crop : Form {
public Crop(Image BaseImage) {
InitializeComponent();
if ((Bitmap)BaseImage != null) { pbOriginal.Image = BaseImage; }
[Code] ....
BaseImage is pulled in from the main form's picture box.
View 14 Replies
ADVERTISEMENT
Dec 13, 2013
I have a class which dynamically allocates memory for three data arrays, and as such in the destructor I told it to delete those data arrays.
However, when I've created a new class, and inherited the previous class - it will always crash AFTER running the program, unless I don't have the previous destructor present.
View 3 Replies
View Related
Nov 4, 2014
I am new to image processing..... and I am learning the concepts.
Recently I have done image rotation of grey scale image using the following formula:
x' = xcos(theta)-ysin(theta)
y' = xsin(theta)+ycos(theta)
The problem i have faced is image is getting cropped.
I want to rotate an image without cropping. I have searched a lot but I am not getting any algorithm based on C. How to get the algorithm for image rotation without cropping.
View 2 Replies
View Related
Apr 19, 2012
Why I keep getting the error: "In function main: [linker error] undefined reference to readBook(BookData)" ....
main.cpp :
Code:
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
#include "BookData.h"
// FUNCTION PROTOTYPES:
void bookInfo(BookData);
void readBook(BookData& book1);
[Code] ....
View 9 Replies
View Related
Oct 6, 2014
I am suppose to make a program that when the user is asked "Enter a Letter for the day:" if the user enters M or m then the screen will output "The day of the week is Monday" and so on until Sunday. I looked over my code and everything looks right but I still get errors saying Missing terminating character " and int function main error.
#include <iostream>
using namespace std;
int main() {
char day;
cout << "Enter a letter for a day of the week: ";
[code]....
View 1 Replies
View Related
May 30, 2014
I have a problem in my code and after hours of looking I really cannot find out what is the problem.I use scanf to to parse lines of a file, let me copy only the important part:
Code:
/*File read...everything is fine*/
int seq_1, seq_i2;
int len;
while(fgets(&line[strlen(line)], line_length, file)!= NULL) {
}
[code]....
if (num_sc ==4) //the wanted format, do something So I am allocating all variables, and giving to sscanf pointers, so I really don't get where the segmentation fault appears.I checked with the debugger, the first line of the file is read, but at the second it crashes at the line of sscanf! The two lines don't have the format I want in sscanf but therefore I check if this number is 4 and then do other stuff to the data...
View 9 Replies
View Related
Oct 24, 2014
This function is apparently causing infinite recursion, but I have no clue what's causing it:
Code:
int pow( int base, int exp ) { int somevariable = pow(base,exp-1);
if (exp == 0) {
return 1;
}
else {
return base * pow(base,exp-1);
}
}
View 10 Replies
View Related
Sep 10, 2013
std vector seems to cause errors when destructing here some simplified code:
#include <stdlib.h>
#include <stdio.h>
#include <vector>
class Foo{
[Code]....
View 5 Replies
View Related
Mar 11, 2014
I've had with visual studio but nothing seems to be working. No matter what I do even with simple programs, like Hello World, I'm always getting an error about a .pch header file.fatal error C1083: Cannot open precompiled header file: 'DebugConsoleApplication1.pch': No such file or directory
This is only for one of the programs I've made but I'm pretty new to programming and I've not even used the header files for anything so I have no clue how to resolve this problem.
View 2 Replies
View Related
Apr 26, 2013
I need to split my main() function into two separate functions.Where would the best place be to split it up?
* Read a text file whose name is given on the command line, and for each word:
* if it is an integer, insert it into an array in sorted order
* if it is not an integer, insert it into an array of words.
* Notes: converted to use C++ strings, because C strings are messier.
* Need to grow arrays, need to insert in sorted order.
* Growing arrays might be done the way we grew a C string:
* bigger = new <type> [size+1]
* for(i=0; i<size; i++) {
* bigger[i] = oldarray[i];
[code]....
View 1 Replies
View Related
Mar 17, 2013
i am running this code but i am geting few errors .as shown in the image
Code:
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <string>
using namespace System;
[Code] .....
View 7 Replies
View Related
Jan 27, 2015
I was working on template and found the linker error while compiling the code.
Below is the code:
Code: //Template1.h: Header file where template define
#ifndef __Template1_H__
#define __Template1__
template <typename T,typename T1> class A
{
T a;
T1 b;
public:
A(T ,T1 ) ;
[code].....
View 8 Replies
View Related
Jul 1, 2014
I am trying to write a function that extracts chunks of numbers from a stream (ie if i had "ui33ui24ui23hjdwejf" it would extract the chunk 33), and its finished, but it wont compile. errors here: [URL] ...... its only one line in an include file, but im stumped. anyways, this is the most updated version of the code: [URL] .....
View 1 Replies
View Related
Aug 17, 2013
I have i want to call a function with two results for example x = 1 and y = 2.How do i return this function in c and how do i call such a function in the main program.
View 9 Replies
View Related
Jan 31, 2014
I am trying to use struct to store variables from a text file and use them in the main program. I have first tried running the program without using struct and declaring the variables within the main program and it runs fine. But after using struct, it gives no compilation error and a segmentation fault as output. Also, if the size of file/variable size is unknown can I declare variables as char string[]??
The code is as below:
Code:
#include<stdio.h>
struct test {
char string1[10000];
[Code].....
View 4 Replies
View Related
Dec 3, 2013
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int encrypt_data(FILE *);
[Code] ....
I am trying encrypt the file "encrypt" when I enter it I get "Error in reading file"
I think its a problem with the fgets() and scanf()...I tried both fgets out and then scanf but I get the same error.
I look in the directory and see that when I enter a file to be encrypted a blank file with a "?" at the end is created in the directory. so I try to encrypt "encrypt" it shows error then creates "encrypt?"
I then tested it by entering a random file name that does not exist
EXAMPLE
Please enter file to be encrypted: fakefilename
Error in reading file.
I look in the directory the non existent file now is listed "fakefilename"
View 1 Replies
View Related
May 12, 2013
I've written a c++ program that contains the following classes: class Shape, Circle, Ellipse, Rectangle, Triangle. All the classes are a subclass of class Shape. They syntax of their definition is fine, I see no visible errors. This is the code:
#include "graphics.h"
//#include <iostream>
using namespace std;
const float Pi = 3.141;
float distance (int x1, int y1, int x2, int y2) {
[Code] ....
Now when I declare a variable of each subclass in the main, I get an error on two of the classes.
int main () {
Circle a;
Rectangle b;
Ellipse d;
Triangle c;
int x1, y1;
float length;
[Code] .....
...And there's a bunch of similar if conditions. My compiler gives an error under b and d, i.e. the Rectangle object and the Ellipse object. The error is, "Expected a ';'" . I have quadruple checked every inch of my code and as far as I can tell, there are no missing semicolons. Where this ";" belongs ....
View 2 Replies
View Related
Dec 8, 2013
Basically, I'm moving a VC project from my Windows 7 build machine to a new build machine that's running Windows 8.1. One of the pre-build steps (for a particular project) runs a script which needs to call the M4 macro processor (which is installed on my C: drive). I've been pretty careful to set everything up the same on both machines (including my PATH) but when I try to build the project on my Windows 8 box, MSVC's IDE shows me this error output when running the script:-
m4 failed with exit code 255
View 5 Replies
View Related
Mar 14, 2013
Write a program with two functions both called from main(). The first function just prints "Hello". In the second function ask the user to enter a number. Calculate the square root of the number and return the result to main(). In main() print the square root value.
Code:
#include<stdio.h>
#include<math.h>
float fun3 (float );
main()
}
[code]...
View 3 Replies
View Related
Oct 13, 2013
I would like my program to display other functions in the int main function. For example, this is what my program looks like:
int Function1(int &var1, int &var2, int &var3) {
cout << "blah blah blah" ;
cin >> var1 ;
var2 = var1 * 3 ; //example
var3 = var1 * var2 ; //example
if(blah blah blah)
[Code]...
View 2 Replies
View Related
May 5, 2014
i have this program I am working on and it seems to crash after the function call getdata()
here is the code
#include<iostream>
#include<string>
#include<cstdlib>
[Code].....
View 1 Replies
View Related
Mar 24, 2013
main()
{
printf("%lf",5/2);
}
this code is giving runtime error ....why ?
View 3 Replies
View Related
May 11, 2014
I'm having trouble implementing my radix sort program on the main .cpp file. Here is what the radix header file looks like::
#include <vector>
#include <queue>
using namespace std;
void distribute(const vector<int> &v, queue<int> digitQueue[], int pwr) {
int i;
for(int i=0; i < v.size(); i++)
digitQueue[(v[i]/pwr) % 10].push(v[i]);
[Code] .....
Here is what my main looks like:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <queue>
#include "radix.h"
[Code] ....
My output:
sorted array is:
0 0 0 0 0 0 0 0 0 0
View 1 Replies
View Related
Nov 5, 2013
I am trying to construct a program without a main function that outputs stars but at the same time outputs the number and a colon after the number but before the number of star. This is the coding i have so far.
void output_stars(int num){
if (num > 0){
cout << "*";
output_stars(num-1)
[Code] ....
The program is working the way it should i just can't figure out how to output the number and a colon. The main function is written as such:
output_stars(1);
output_stars(2);
output_stars(5);
output_stars(3);
output_stars(4);
output_stars(7);
How to get the numbers of the main function to show up with the stars of the previous function.
View 6 Replies
View Related
Sep 29, 2013
Thing I want is find the largest sum down a triangle,(moving to adjacent numbers on the row below )there are many methods to go down.
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
I wrote a program with a recursive() called finder. But it dose not work properly,at run time it becomes to a infinite status. How to detect the error at runtime. Here is the code.
#include<stdio.h>
void finder(int x,int y);
int tot;
[Code] ....
I think the error is the changing value of x after a round of for loop.
View 2 Replies
View Related
Mar 27, 2015
In Visual Studios I keep getting this error. cpp(36): error C4700: uninitialized local variable 'Eligible' used
Code:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
void Getinput(int& Loantype, double& Income, double& Totaldebt, double& Loanamount);
[Code] ....
View 4 Replies
View Related