C :: Program To Find Mean Of Elements In Columns Which Are Divided By 3
Aug 9, 2014
The program need to find mean of elements in columns which are divided by 3. And to print which colmn has the greater mean
Example
For matrix:
7 9 5
17 15 30
29 34 60
Program print: 0 12 45. The greater mean: 3 column.
I wrote this code and it prints 0 12 45 idk how to find which column has greater mean?
Code:
#include <stdio.h>
#define max 50
int main()
{int n,m,i,j,k,d,br=0,suma;
int a[max][max];
int b[max][max];
printf("Kolku redici i kolku koloni da imat matricite: ");
scanf("%d %d ", &n,&m);
[Code]...
View 2 Replies
ADVERTISEMENT
Aug 28, 2013
I need to create a program that will find the total of all the elements in array. I need to use for loop and the array size is 10.The output should be like this: i used user input
Input array 0 : 2
Input array 1 : 4
Input array 2 : 6
Input array 3 : 7
Input array 4 : 8
Input array 5 : 9
Input array 6 : 10
Input array 7 : 12
Input array 8 : 16
Input array 9 : 20
Sum of 10 numbers in an array is = 94..Press any key to continue..I have a code but the output is not like that. Here is the code,
// Program to store 10 integers array
#include <iostream>
#include <stdio.h>
using namespace std;
int getArray(int x[]);
[code]....
View 16 Replies
View Related
Mar 29, 2014
I'm trying to make a simple program that will show me how many numbers on the list can be divided with 2.I have tried like this :
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[Code]....
There is a textBox1 where i,with button1, add number to the listbox1.In listbox2 ,i should get a result.
View 6 Replies
View Related
Jun 14, 2014
I have a function where i declared the number of elements in a vector alocated dynamically which returns the vector to the main function. The problem is how can i find the number of elements in main function? I tried length = sizeof(a) / sizeof(int) which gives me the same value, the value of the first element. Here's the code:
int* functie2 (void)
{
int* p;
int c,i;
printf("number of elements: ");
scanf("%d",&c);
[Code]...
I know i could first read the value of c in main and then pass it thorugh parameter, but how can i do it the other way arround?I could also send the value of c allocating one more int value to the vector, but i don't want doing so.
Where's the edit button?
View 4 Replies
View Related
Apr 23, 2014
Im using apmatrix and im inputting values into a 4 by 4 matrix and im getting all these errors that have nothing to do with my cpp file so im guessing its apmatrixies fault. Also I put in the cpp and header file of both apmatrix and apvector into my project folder. Heres my code:
// Libraries
#include "apmatrix.h"
#include <iostream>
//cout, standard output
// <<, stream insertion operator
[code]....
My errors are:
error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.c:program filesmicrosoft visual studio 11.0vcincludexkeycheck.h2421TheMatrix
4IntelliSense: identifier "EMIT" is undefinedc:Program FilesMicrosoft Visual Studio 11.0VCincludeyvals.h4911TheMatrix
and a bunch are repeated
View 1 Replies
View Related
Oct 30, 2013
How would i get the total amount of elements From the input file(The .dat file) and then store them in a variable?Here is an example to show you what i want. If a line on the .dat file looked like this
1 2 3 4 5 6 7
How would i find the total number of elements? For example the total number of elements in this line would be 7.
View 9 Replies
View Related
Dec 17, 2013
I have a question. How to find the average value of all the elements in a deque?
View 2 Replies
View Related
Jan 12, 2014
I would like to know the algorithm or flow for finding unequal elements in an array entered by user. I tried using for loop but didn't get the expected output
Code:
#include <iostream>
#include <string>
using namespace std;
int main() {
int a[10],b[10]; //array of integer elements
[Code] ....
View 6 Replies
View Related
Feb 4, 2015
I have a N queens (actually 8 queens to be specific) program that accepts the numbers in order by row. I need to get it so it accepts the numbers in order by column. At first glance I thought it was just one space different, but it turned out not to be and how to get the one space difference in there. My current code (which I'm aware isn't doing the column accepting right) is:
Code:
#include <iostream>
using namespace std;
int main() {
int board[8];
cout << "Enter the columns containing queens, in order by column: ";
for(int i = 0; i < 8; ++i) {
cin >> board[i];
[Code]...
What the output should be:
Code:
Enter the rows containing queens, in order by column:
7
6
5
3
4
2
1
0
.......Q
......Q.
.....Q..
...Q....
....Q...
..Q.....
.Q......
Q.......
What it is:
Code:
Enter the columns containing queens, in order by column:
7
6
5
3
4
2
1
0
........Q
.......Q.
......Q..
....Q....
.....Q...
...Q.....
..Q......
.Q.......
View 5 Replies
View Related
Nov 18, 2014
I'm not sure why Im getting a wrong Sum. of the Columns.
Write a method that returns the sum of all the elements in a specific column in a matrix using the following header:
double sumColumn(const double m[] [SIZE], int rowSize, int columnIndex)
Write a test program that reads a 3-by-4 matrix and displays the sum of each column. here is a sample run:
Enter a 3-by-4 matrix row by row:
1.5 2 3 4
5.5 6 7 8
9.5 1 3 1
Sum of the elements at column 0 is 16.5
Sum of the elements at column 1 is 9.0
Sum of the elements at column 2 is 13.0
Sum of the elements at column 3 is 13.0
#include <iostream>
using namespace std;
const int SIZE = 4;
int rowSize=3;
[Code].....
View 1 Replies
View Related
Mar 31, 2013
Develop a function that finds the greatest difference between two consecutive elements stored in an array. Develop a 9 element array of doubles to test your code. Print to the screen which two numbers have the greatest difference as well as the value of the difference. Finally include an overloaded version of the function that will work if the array is composed of integers. Include your code used to test this function.
View 8 Replies
View Related
Oct 7, 2014
I tried to work on this program for while, but I am not able to get it to work
Directions:Write a program that reads an integer n from the user.
Display the first 100 numbers, with newlines every n numbers, using % operator
#include <stdio.h>
int main(void){
int a = 0;
int b = 99;
printf("Enter a number: ");
scanf ("%d", &a);
[Code] ....
When I run this code it asks me to enter a number. It doesn't matter what number I enter it gives me the numbers from 1 to 100 in one horizontal line.
I want this program to do something like this:
for example if the user enters n=6 the program should give:
0 1 2 3 4 5 6
7 8 9 10 11 12 13
and so on
View 2 Replies
View Related
Feb 7, 2015
I am writing a program that deals with 2d arrays. The program inputs the number of rows and columns and asks for the entries. When the program run and compiles it works perfectly until it outputs then it gives me a warning.
Here is my code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int row1=0,col1=0,i,j;
//int a[row1][col1];
int** a= new int*[row1];
[Code]...
I am learning how to do this before I can move on so it can read a text file of numbers.
Also I am having problems with ////delete [] a[];///// I took it out because it made my code compile and run but when I add it in, it gives me an error:
matrixtesting.cpp|56|error: expected primary-expression before ']' token|
I know this expression is suppose to deallocate the array.
View 7 Replies
View Related
Dec 12, 2013
Here your supposed to create a program that takes in information and formats it into three columns.
I can't seem to use the float variable unitprice with decimal places here for, if I try to use %.1f and type in an input, the program seems to skip over the second scanf function, not allowing me to put input into the third scanf function as the program runs before I can.
I can use %f on its own and it works but this creates too many zeroes(and you're supposed to set the currency limit to $99999.99).
Code:
#include <stdio.h>
int main(void) {
int itemno, month, year, day;
float unitprice;
[Code]....
So the output should look like three columns. It's just the float that is the issue here....
View 5 Replies
View Related
Mar 3, 2013
So I am currently working on a program that will remove elements from an array. Suppose I had a 3x3 Array
1 2 3
4 5 6
7 8 9
and chose the element 5 as the one I wanted to remove. How would I do that? This is where I am so far.
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <time.h>
#include <algorithm>
#include <vector>
using namespace std;
[Code]...
View 6 Replies
View Related
Sep 24, 2014
This program does everything i want except for one major problem and one small one.
1. The program keeps taking my last entered number and counting it as max and min
2. When I go to end with 0 it adsd the enter number prompt then returns.
#include <iostream>
using namespace std;
int main()
{
[Code].....
View 1 Replies
View Related
Sep 25, 2014
Q)Write a program to find the sum between (2 numbers )
what's the problem here !
#include<stdio.h>
main()
{
int a,b,c;
int sum=0;
for(a=0;b>a<c;a++)
{
printf(" number1=");
[Code]...
View 5 Replies
View Related
Mar 6, 2014
How to make a program that find vowel in each word.
For ex:
he is good.
No. of vowel:
1
1
2
View 4 Replies
View Related
May 26, 2013
i have written a program to find area of triangle, but i meet some errors,
//******area of triangle******//
#include<iostream>
using namespace std;
[Code].....
View 1 Replies
View Related
Aug 12, 2014
Given that today is June 9, thursday, write a program that will print the day of the week on June 9, after x years from now. Assume one year is 365 days.
View 2 Replies
View Related
Feb 16, 2014
In my C++ program, lets call it menu.exe, I want the user to be able to run a specific program when selecting a specific menu, let's call this program cios.exe.
As the users of my program can have the cios.exe installed in any folder location, I need a way to first locate where the cios.exe is located and then start it with ShellExecute. My problem is : How do I find the path to where cios.exe is located in anyones PC as it can be installed it any folder location.
View 3 Replies
View Related
Sep 13, 2014
I have written a program that will input a text file named "inarray.cpp", which contains 10 numbers each separated by a comma, into an array and display the majority on the screen. I am having trouble reading the file in the correct way. For example the numbers have to be on their own separate lines with no commas for my program to work.
ie...
I need to read in 1,2,3,4,5...
but instead i am reading 1
2
3
4
.
.
.
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
[Code]......
View 1 Replies
View Related
Mar 24, 2013
I want to find transpos of square matrix.but my program does not run complete.
Code:
#include<iostream>
using namespace std;
const int size=3;
void read(int a[size][size])
[Code] .....
View 2 Replies
View Related
Jan 28, 2014
I'm doing a program about finding out the solution of a sudoku puzzle. I've been thinking about how I'm going to check every box of the small 3x3's. What would be the best and most efficient way of doing that?
View 9 Replies
View Related
Dec 5, 2013
I am writing a program to find the square root of a number. I am using the Newton-Raphson method..Just to clarify a bit of the code.. fabs(1/(x+1)) < 0.001 is to check for relative error..
EXAMPLE: for user entry of 100 if the iteration process ends in 10.055 the answer will return as 10 which is correct. But it isn't doing that.
It compiles I then proceed to run it..prompts me "Enter a number to find the square root of: I type 100 then hit enter...
"The square root of 100 is -1077834936"
My first time writing a program from complete scratch.
And I know there is a sqrt() function...just wanted to write my own.
Code:
#include <stdio.h>
#include <math.h>
double mysqrt(double a);
int main()
{
double a, result;
printf("Enter a number to find the square root of: ");
[Code]...
View 1 Replies
View Related
Oct 1, 2014
This is just the portion of my program. This program displays Not Found even if the id number is found.
void search(void) {
char ID[10];
int i, found;
cout<<"Enter ID to search: ";
gets(ID);
found=0;
for(i=0;i<top;i++)
[Code] .....
Here's the incorrect output
Enter ID to search: 111
Not found
Name: jude
ID: 111
Semester: 1
Major: IT
I just want to remove the "Not found".
View 1 Replies
View Related