C :: Program To Create 2D Array For Each Row
Feb 14, 2013
What I am trying to do is to have the program create 2D array that for each row, no two numbers are the same and only consists numbers between 1-9. The array lists out every possible combinations. Supposely I do not know the number of possible combinations, I had it keep adding new rows until there are no more possiblities left.
The problem with my code is when I print out the completed array, it gives out really, really large numbers. But when I print the array from inside the first loop, it gives correct values. I do not know exactly what happened.
Code:
#include <stdio.h>
int main(void) {
int double_digit[1][2];
int a = 1;
int b = 1;
[Code] ....
View 5 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
Feb 27, 2013
The assignment is to create a program that displays the median of an array using pointers. Assume the array is already in ascending or descending order.I'm getting errors currently on the bottom two "return median;" statements.The code that I have so far is as follows...
#include <iostream>
using namespace std;
char again;
int getMedian(int*, int);
const int constant = 100;
[code]....
View 3 Replies
View Related
Oct 26, 2013
I have a struct called Array and I'm to create a function to create a dynamic array that's fill with randomly generated integers from 0 to 50 (inclusive) and a function to destroy the array for freeing its memory. Below the code that I have written so far.
Code:
* Struct */
typedef struct {int *pArray; //the dynamic array
int length; //the size of the dynamic array}Array;
/* Function to create a dynamic array */
Array *initializeArray (int length) {int i;
}
[code]....
View 7 Replies
View Related
Nov 24, 2014
I got this program to create an array of playing cards and assign the values and suits and shuffle the array. I'm at the point where I need to output the cards but I need to burn the first card by making it output "**" instead of the card. my cards[] is a constant so I can's assign the first card as such.
void showCards(const int cards[], int numCards, bool hideFirstCard) {
if (cards[0]) {
hideFirstCard=true;
cards[0] = '**';
} for(int a = 0; a <= numCards; a++) {
cout >> showCard(cards[a]);
} }
View 1 Replies
View Related
Jan 26, 2015
I want to create a program that would take an AVI file, alter each frame (ex: change contrast, invert colors, etc.) and dump a new AVI. I've wrote a simple program for this experiment that loads up the header information from the video and dumps it. It also dumps a list of the frame data chunks within the 'movi' chunk.
The info I've gathered from coding this:
1. The recommended buffer size for each type of stream (vids, auds, etc.) is the size of the largest frame of corresponding type, plus 1 or two extra bytes.
2. numFrames in main header is the total number of frames for all types of data (video,audio,etc.) The 'length' value within stream header of type 'vids' is the number of video frames. The sizeImage value within BITMAPINFOHEADER is 921600 (==640*480*3) and the specification states that, quoth, "This can be set to 0 for uncompressed RGB bitmaps."
3. This video uses DIVX encoding.
Now my problem is this: How do I get the data within each video frame in a simple BMP like format? Even the uncompressed frames (with chunk id 'nndb') have variable sizes...let alone the compressed ones.
Information about a software that converts AVIs to a format with fixed sized uncompressed frames. Or at least some information about the frame decompression techniques.
Here's a dump made by the program for a 9 sec, 640x480 video I recorded from Pokemon. (Without the frame dump that is, it'd have made the post too long.)
Code:
AviMainHeader
-------------
size = 56
usecPerFrame = 66666
maxBytesPerSec = 7680000
padSize = 0
flags = 0x00000810
numFrames = 162
initialFrames = 0
numStreams = 2
[Code]...
View 4 Replies
View Related
Oct 29, 2014
So, I was trying to code a menu for a personal movie database. But I'm having some problems.So, this is what I did,
Code:
#include<stdio.h>
int main();
{
do
{printf("Menu
[Code]...
But this is not working.Furthermore I would also like add a sub menu.
View 7 Replies
View Related
Sep 2, 2013
I have a homework assignment due that told me for the "input specification" that "n" is an integer greater then 0. How would I put this in and where?
View 1 Replies
View Related
Apr 10, 2014
i want to create a program which consist of 2 function. one function should find the greatest number and the other one should calculate the average but when i run this program i get segmentation fault
Code:
#include<stdio.h>
int main() {
int k,i,A[k];
[Code]....
View 8 Replies
View Related
Nov 16, 2013
I would like to create a C program which requires the input in this form: number1 operator number2, where number1 and number2 are numbers of type double and operator is one of the characters +,-,*,/.
There is my attempt to write this code:
Code:
#include <stdio.h>
double main() {
char operator;
[Code]....
Now I have to solve these problems: This code above doesn't work and I don't know why.I don't know how to fix the case when some user enters the input in this form:
Code: 1.5896 *5 or
Code: 7 / 5
I mean how the program knows that
Code: 1.5896 *5 is the same as
Code: 1.5896*5
I don't know how to fix the case when the user enters the input in the incorrect form for example
Code: 3
View 4 Replies
View Related
Mar 30, 2014
create a program that trigonometric series ∑(k-3)sin(π/k-3) with k = 4 until 13..
View 1 Replies
View Related
Nov 5, 2013
You are to create a program using nested looping. Your program is to have a menu asking the user to select which pattern to create and how many rows to use (it should accept 1 to 10 rows and keep the aspect ratio of the pattern). The patterns are 1 - Box, 2 - V, 3 - Inverted V. Note, if I select pattern 1 with 10 rows, the box will have 10 asterisks in the first row.
Okay so i came up with the box but i have been getting stuck at getting the V or inverted V.
View 1 Replies
View Related
Apr 6, 2014
Im trying to create two box in this program using the default constructor. When i call to try and display the info, it says that x, y, and z are not declared in this scope. i wanted to have the user cin the length, height, and width using the void setBox function.
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
class Box{
public:
[code]....
View 2 Replies
View Related
Sep 4, 2013
how can I create a program that will accept 2 two integers. the user will also choose among the different operations:
1 for addition
2 for subtraction
3 for multiplication
4 for division
View 4 Replies
View Related
Aug 18, 2013
i am trying to create a program for multiple windows. Here is my code
#include<Windows.h>
// Store handles to the main window and application instance globally.
HWND ghFirstWnd =0;
HWND ghSecondWnd=0;
HWND ghThirdWnd=0;
HINSTANCE ghAppInst=0;
[Code]...
problem is when i try to execute the code it just say create window1- failed!!
View 1 Replies
View Related
Feb 10, 2015
1. Write a c++ program to create a vector of integers. copy the vector contents into list, sort the contents, then copy selected items into another vector(like elements less than 10 etc)
View 1 Replies
View Related
Apr 2, 2013
I am trying to write a program that creates a hybrid image I've hit a roadblock early on my code throws up an unhandled exception I cant find where it goes wrong I need a fresh perspective on this. Here is my code so far
#include <iostream>
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
using namespace cv;
Point P11, P12;
Point P21, P22;
[Code] .....
View 5 Replies
View Related
Aug 22, 2014
I've created this code that differentiates between various uses of banks like for example if the user enters he went to bank to deposit money and then went to the river bank.The output will be finance river.
The code is not working correctly.
#include<fstream.h>
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
[code]......
View 6 Replies
View Related
Dec 30, 2013
i want to create a program that allows a user to list all create new items, list those items, delete an item, modify an item, search for an item how can i do that This is my work so far
Code:
#include <stdio.h>
#include <string.h>
struct listofitems
char itemName [50];
float itemPrice = 0;
}
[code]...
View 1 Replies
View Related
Feb 16, 2015
So im trying to create a program that will calculate a shipping cost. I'm stuck on trying to calculate the actual milage and cost. Example being 1400 miles for a 2lb package would be $2 for every 500miles. so it would cost $6. But Im having trouble getting the program to round up the 1400 to 1500 so it charges the correct amount.
I know there would have to be a way to do this without programming all the conditions.
Also the course has not reached loops yet.
Code:
// This program will calculate the shipping charges.// The shipping rates are based on per 500 miles shipped.
// They are not pro-rated, i.e., 600 miles is the same rate as 900 miles or 1000 miles.
#include <stdio.h>
#include <stdlib.h>
[Code]......
View 1 Replies
View Related
Dec 20, 2014
I want to make a programs which creates a dialog box and shows it to the user. The dialog box should not be pre-loaded, here's an example:
cout << "Button a"
cin >> a
cout << "Button b"
cin >> b
cout << "Button c"
cin >> c
[Code] .....
Each button should be under the other. How can I do this in a C++ project?
View 1 Replies
View Related
Mar 20, 2014
I need to create a program that lists off each digit of an integer and then display the sum off all the digits in that integer. I know that sepereatly the sum function i wrote works. But the first part which i try to list off the digits work but in reverse order which i dont know how to correct. and for some reason that i cant figure out this is affecting the sum output.
#include <iostream>
using namespace std;
int digcount (int x) {;
[Code]....
View 5 Replies
View Related
Nov 19, 2013
I know it would be easier to create an int array, but I want the program to create integers as the user requests. For example, if the user enters 4, the program creates 4 integers with the names input. Each integer is better as an individual integer, not an element in an array.I'm not sure if this is a possibility with C++.
View 3 Replies
View Related
Jul 9, 2013
I want to make a program that can know the current time and create a new .txt file.For example if its Monday to day then when its Tuesday it crates a new txt file called Tuesday.I really don't know how to go about this.I know i will need to use the time.h library.
View 4 Replies
View Related
Dec 16, 2013
I am trying to create a program that calculates fraction of time remaining when a student leaves during the middle of the semester. I have to use function files here. I am having trouble with the division in function long double tuitionfrac(int, int, int). No matter what numbers are entered, fractime gives an output of 0. I don't understand that.
long double tuitionfrac(int opening, int leaving, int semend)
{
int lefttime = semend - leaving;
cout << "Left time " << lefttime << endl; //for error checking
int tottime = semend - opening + 1;
cout << "Total time " << tottime << endl;
long double fractime = lefttime/tottime;
cout << "fractional time " << fractime << endl; //always returns as 0.
return fractime;
}
View 4 Replies
View Related
Feb 1, 2013
I am doing a project, which requires me to create a program which would calibrate the camera. The code is below.
#include<opencvcv.h>
#include<opencvhighgui.h>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
using namespace cv;
int main() {
int numBoards = 0;
[Code] ....
I am a beginner to opencv.
View 14 Replies
View Related