C++ :: Sum Of Diagonals Of Matrix - Program Giving Segmentation Error?

Jan 7, 2015

After entering the values of the matrix, it is giving me segmentation error. also "if possible", correct it

#include<iostream>
using namespace std;
int main()
{

[Code]......

View 2 Replies


ADVERTISEMENT

C++ :: Program To Find Quarks And Their Charge And Mass - Giving Error

Mar 3, 2013

I have been looking and i'm stuck on this. I wrote this program to find quarks and their charge and mass but i need it to give me 5 different ones. so i made an array but when i run it it gives me this

"Unhandled exception at 0x001631c6 in DiasQuarkP1V0.exe: 0xC0000005: Access violation reading location 0xd5bf0c38." and it shows the xstring library.

this is my main, is their anything wrong with my code?

#include "StdAfx.h"
#include <stdio.h>
#include <string>
using namespace std;
int main() {
Quark solution[5]={};

[Code] .....

View 1 Replies View Related

C :: When Run The Program Getting Segmentation Fault (core Dumped) Error

Mar 21, 2013

Here is the code, and I can get it to compile successfully, but when I run the program, I get a "segmentation fault (core dumped)" error. I am guessing it might be related to a buffer overflow but I cannot say for sure.

Code:
#include <stdio.h>
typedef struc {
int recordNo;
char name[20];
int qty;
float cost;

[Code] .....

View 1 Replies View Related

C/C++ :: Binary Search Tree Program - Segmentation Fault Error

Mar 21, 2014

I'm writing a binary search tree program and I got it to compile but as soon as I input something it returns a "segmentation fault error" . I suspect the issue with the code is withing my `add` function.

template<typename T>
void BinarySearchTree<T>::add(T value) {
if (m_root == nullptr) {
Node<T>* node = new Node<T>;
node->setValue(value);
m_root = node;

[Code] ....

View 6 Replies View Related

C++ :: Array / Pointer Giving Error?

Jul 20, 2013

The program should ask the user how many students were surveyed and dynamically allocate an array of that size. The program should then allow the user to enter the number of movies each student has seen.

#include <iostream>
#include <string>
using namespace std;

[Code].....

The problem I'm having is that where I declare movies = [numStudents]; the semicolon after the numStudents array is giving me this error - "error: expected a '{' introducing a lambda body".

View 2 Replies View Related

C/C++ :: Sequential Matrix Multiplication Program - Syntax Error Near Unexpected Token

Apr 30, 2014

I wrote a sequential matrix multiplication program in c.

After execution i get error like
./mul.c: line 11: syntax error near unexpected token `('
./mul.c: line 11: `int main(){'

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define wA (30 * 16)
#define wB (50 * 16)
#define hA (80 * 16)
#define hB wA
#define wC wB

[Code] ....

View 4 Replies View Related

C++ :: Matrix Printing - Getting Segmentation Fault

Feb 18, 2013

I need getting my initializer to work for my project. I get a segmentation fault when I try to print out what I've done.

#include <iostream>
struct matrix {
protected:
double * * data;
int rows, columns, size;

[Code] ......

View 3 Replies View Related

C++ :: Threads Giving Error - Call Of Object Of A Class Type Without Appropriate Operator Or Conversion

Jan 27, 2015

I made a simple binary tree then decide to try out threads too. I got the following error:

call of an object of a class type without appropriate operator or conversion

Code:
#include "Tree.h"
#include <iostream>
#include <thread>
void main(void){

[Code] ....

I am having a hard time figuring out why the error exists. I tried adding the new operator but that did not work.

View 11 Replies View Related

C++ :: Giving Audio Input To A Program

Sep 27, 2013

I want to give audio-input to a FFT code (KissFFT) written in C, on a real-time basis. While I can give a simple test signal (like sine wave) by writing the sine function as input, I am not sure how I should convert an audio-signal (e.g.: song) into a form that can be taken as input by the KissFFT C code.

View 3 Replies View Related

C :: Keep Getting Segmentation Fault Error

Oct 28, 2013

Writing a program to search a file and print out the occurrences of each letter in the alphabet.

Code:

#include <stdio.h>
char input[500];
int input_c[26];
int i;
char count=0;
}

[code]....

View 8 Replies View Related

C++ :: Segmentation Error When Saving File

Apr 21, 2014

I have been working a while with saving and retrieve structs, and I still have not got it to work. I get Segmentation fault sh "${SHFILE} . I have search this error, and it has something to do with memory, but what, since I am a beginner with saving and retrieving files. The project runs fine, and the error stated above outputs into my console window as text.

Here are my two structs:

struct checkbook {
char id[50];
double value[50];
};
struct fbook {

[Code] ....

Here is how I save and retrieve my structs:

void saveCheckbook (string file, checkbook checkbook, double initial, int counter) {
string path = "C:UsersAshwinGoogle DriveC++Checkbook" + file;
fbook save;
save.counter = counter;
save.initial = initial;
save.book = checkbook;

[Code] ...

View 1 Replies View Related

C :: Finding Diagonals Of Array?

Apr 11, 2014

Most of this program is working correctly, however when I get to the part on lines 70 to 78 to try and use the function on lines 103 to 113 to find out each diagonals value and then print each one back. But when this runs it only returns the value for [0][0] for each run through the loop and I'm not really sure why. I know its probably something simple but I'm just missing it,

Code:
1 #include<stdio.h>
2 #include<stdlib.h>
3 #include<time.h>
4 #define MAX 100
5
6 void display_menu();
7 int check_option(int);

[Code]...

View 4 Replies View Related

C/C++ :: How To Reverse Diagonals In 2D Array

Jan 9, 2013

I have been trying this for so long. I need to make a separate function named reverseDiagonal where I have to reverse the diagonals in a 2D array.. I have tried swapping it but i don't know where to place the "cout" and print the diagonal.

View 4 Replies View Related

C++ :: Segmentation Fault - Memory Error When Looping Over Function?

Mar 24, 2014

It is been several days that I am stucked with the segmentation error and I do not know anymore what to do I try to do a loop over my function but it is working only for my first iteration. Here the code:

#include <iostream>
#include <cstdio>
#include <cstdlib>

[Code].....

I would like to iterate over solvep (since h is changing at each iteration..I usually add other fct but now I try to debug why the loop is not working.).The first iteration is working fine but not the other iterations.

View 4 Replies View Related

C :: Random Number Game - Segmentation Fault (core Dumped) Error

Jun 25, 2013

Ok, so doing an assignment for a random number game where you guess and it says too high or too low until you get it right or run out of tries. Here is what I got so far:

Code:
//Cameron Taylor

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main(){
srand(time(0));
int number = rand()%100+1;;
int guess, numberGuess;

[Code] ....

Getting "Segmentation fault (core dumped)" after inputting the first number, but it compiles correctly.

I later have to add "Do you want to play again (y/n)", so I will use this post to continue that later.

View 13 Replies View Related

C :: Getting Error On Matrix

Mar 6, 2015

I've a code and it works on my linux laptop; however it doesnt work on a matrix server. Im getting error Code: file.c: In function CondCheck:file.c:40:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default] The code of the programme

Code:

#include <stdio.h>
#include <string.h>
#include <math.h>
/*DECIMAL TO BINARY CONVERTER*/
int BinaryConverter (int bina)
}

[code]....

View 1 Replies View Related

C++ :: SSE Matrix Multiplication Error

Apr 25, 2014

I have been using SSE/ SIMD Matrix multiplication approaches and I persistently get this error:

void mmul_sse_nsize(const float * a, const float * b, float * r, int size) {
__m128 a_line, b_line, r_line;
int bound = size*size;
int rows = size;

[Code] ....

The code almost never throws the error when matrices are size NxN, N =4.

Also, I have a 4 core laptop with 2 GB RAM and I am using VS2013.

View 3 Replies View Related

C++ :: Matrix Runtime Error - Access Violation

Jan 13, 2015

When I am giving elements for row 2 ,program crashes .it says access violation.

Code:
#include<iostream>
#include<vector>
#include<string>
using namespace std;
void matrix_init(vector<vector<string>>& v)

[Code] ....

View 4 Replies View Related

C/C++ :: Sequential Matrix Multiplication - Error In Execution Time

Apr 30, 2014

I wrote program for Sequential matrix multiplication .But after execution for any input value( ex. 100,150,400) it shows the execution time is 0.000 msec.

#include <stdio.h>
#include <math.h>
#include <sys/time.h>
void print_results(char *prompt, int N, float *a);
int main(int argc, char *argv[])

[Code] ......

View 2 Replies View Related

C :: Why Program Keeps On Getting Segmentation Fault

Jul 21, 2013

I can't understand why my program keeps on getting "Segmentation Fault". The last time I checked (in UBUNTU) it was already working, now I'm testing it in Windows and I keep on getting "Segmentation Fault".

Code:

#include <stdio.h>
#include <string.h>
int main(){
char string[1500];
char word[100];
}

[code]....

View 10 Replies View Related

C++ :: Get A Segmentation Fault With Program

Jun 28, 2013

I can't work out why I get a Segmentation Fault with my C++ program.

Here is the code:

#include <iostream>
#include <string>
#include <stdexcept>

[Code].....

View 5 Replies View Related

C :: Program Received Signal - Segmentation Fault

Sep 29, 2014

gdb result is

Code:
Program received signal SIGSEGV, Segmentation fault.
isoc99_fscanf (stream=0x0, format=0x4014e0 "%u %u %u %u")
at isoc99_fscanf.c:30
30 isoc99_fscanf.c: No such file or directory. Code:

[Code].....

View 2 Replies View Related

C :: Program That Provides Number Of Utilities For Strings - Keep Getting Segmentation Fault

Nov 22, 2014

I'm working on a program that provides a number of utilities for strings, but I keep getting segmentation faults and I cannot tell why. strContains works fine, but basically the rest of my functions throw seg faults.

Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"string_utils.h"

int strContains(const char * str,const char * subStr) {

[Code] ....

View 5 Replies View Related

C :: Program That Writes Words To Text - Segmentation Fault 11

Nov 25, 2013

I'm trying to make a program that writes words to a text. The words are generated by a brute force program. I am getting a segmentation fault 11...

Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static const char alphabet[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"1234567890";

[Code] .....

View 4 Replies View Related

C :: Calculate Product Of Two Matrices - Segmentation Fault In Program

Oct 29, 2014

New to C Programming, I have a problem with a little program I made that calculates the product of two matrices.

And here is the error I get:

View 4 Replies View Related

C++ :: Forming A Matrix Multiplication Program

Oct 9, 2013

I just started Linear Algebra for my programming degree and to full understand everything I want to put it into code and make my own "matrix calculator." I have all the theory but I am having issues keeping the matrix variable and moving it around the class' functions to create it and output it. Once I know I have it saved I think I can get the addition/multiplication to work. Here is the code I have so far:

#include <string>
#include <iostream>
using namespace std;
class matrix {

[Code] ....

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved