C++ :: Multidimensional Arrays - Enter Data Into Table And Display On Screen In Tabular Form

Sep 8, 2014

Write a program to enter data into a table and display on the screen in tabular form. I want to know where are the errors.

#include<iostream>
using namespace std;
int main() {
int table[3][4];
int r,c,i;
r=c=0;
while(r<=2)

[Code] .....

View 3 Replies


ADVERTISEMENT

C++ :: Read Data From A File Then Store / Search And Display Using Classes And Arrays

Apr 12, 2013

A company uses two text files: one to store employees' details and another to log their sign in/out time.

The details file - called details.txt" has the following format: ID, Name, Date of Birth, SSN, Department, Position - separated by spaces.

An extract from the file looks like this:

10 alice 4/23/1972 123-45-6789 support assistant
3 bob 6/7/1980 111-12-1134 logistics manager
1 carol 10/2/1963 987-123-1143 admin ceo
2 dave 10/3/1974 902-22-8914 admin cfo
17 erin 6/13/1991 126-83-1942 technology supervisor
15 frank 2/22/1987 303-12-1122 logistics assistant

"timelog.txt" contains daily logs of when employees arrive and leave. It has the following format: ID, Date, Arrival Time, Departure Time - separated by spaces. An extract from the file looks like this:

10 2/11 0900 1700
3 2/11 0930 1730
1 2/11 1100 2000
2 2/11 1000 1530
17 2/11 0900 1700
10 2/12 1000 1830
3 2/12 0930 1730
1 2/12 1100 1900
2 2/12 1030 2000
17 2/12 0900 1700
15 2/12 1100 1600

I have to write a program that searches for specific records using some search parameter, and displays them. Ok first i have to read the data from the files and store them. this is what i have so far....

#include <iostream> //Accesses libaries for console input and output
#include <fstream> //Needed to access the fstream object to read files
#include <string> //Needed to access the string class
#include <cstdlib>

[Code] ....

I know my class and array code is totally wrong i dont know how to store the data for the info is in integer and string form... do i use strings, arrays?

View 1 Replies View Related

C/C++ :: How To Use Multidimensional Arrays

Apr 10, 2014

I am trying to use multidimensional arrays. I have made a 9 by 3 array and I am trying to use it in my code. Now I am trying to print the content of a particular subscript on user demand but it is giving me some weird error. Everything seems ok to me. Heres my code

#include <stdio.h>
#include<Windows.h>
int main(void) {
double array1[9][3]={{1000.99, 2000.99, 3000.99}, {950.99, 800.99, 700.99},{850.99, 750.99, 600.99},{725.99, 625.99, 525.99},{650.99, 550.99, 450.99},{655.99,555.99,455.99},{350.99, 250.99,200.99},{325.99,225.99,175.99}, {300.99,150.99,100.99}};

[Code] ......

View 6 Replies View Related

C :: Strcmp Of 2 Multidimensional Arrays

Aug 6, 2014

I have used strcmp before on one dimensional arrays but not 2 dimensional arrays.The problem is that I have one 2d array that has text with some misspelled words and I have to compare it to another 2d array and if the word from the first array (misspelled word) is not in the 2nd array then I print it to the screen instead of correcting the spelling. Here is what I have so far:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int read_dic(char [], char [][20]);
int read_words(char [], char [][20]);
void typo_check(char *, char *);
}

[code]...

View 5 Replies View Related

C++ :: Multidimensional Character Arrays?

Jan 19, 2013

I'm trying to create Minesweeper and with 2D Multidimensional character Arrays, It doesnt appear like in a grid format i want it to.

#include<iostream>
#include<conio.h>
#include<string>
#include<cstdlib>
#include<ctime>

[Code]....

View 1 Replies View Related

Visual C++ :: Allow User To Enter A Value As C String In Certain Form

Oct 14, 2013

My program was to allow the user to enter a value as a C string in the form: xxx,xxx,xxx,xxx,xxx.xx, where x can be any digit. Well, so far here is my attempt. I think the question is, would I have to implement a switch statement for the digits, the comma, and the decimal, so that when a user inputs, let say 52,000.00 the switch statements would read the 1st digit, checks for decimals/commas and if not, proceed to read 2nd digit, and repeat?

Code:
#include <iostream>
#include <string>
int main() {
using namespace std;
char buffer[256];
char tempBuff[256] = {'

[Code] ....

View 3 Replies View Related

C/C++ :: Enter Integer And Find Multiplication Table

Oct 19, 2014

This program to find the multiplication table, need explanation this step : printf("%d * %d =%d ", n, i, n*i);

#include <stdio.h>
int main() {
int n, i;
printf("Enter an integer to find multiplication table: ");
scanf("%d",&n);
for(i=1;i<=10;++i) {
printf("%d * %d =%d ", n, i, n*i);
} return 0;

View 7 Replies View Related

C Sharp :: Copy Data Table To MySQL Table

Mar 25, 2013

I have a C# .NET Application which get data from QuickBooks via the ODBC Driver and save the result to C# data table. So, I want to transfer this data table to a mysql table on my own server. That's the code I use:
 
using System.IO;
using MySql.Data.MySqlClient;
//Add mysql dll on the .NET Tab in Project's references  
string connStr = "DSN=QBTest;";  
            string myServerAddress = "192.168.0.243";
            string myDataBase = "CostTest";

[Code] ....

View 2 Replies View Related

C :: Multidimensional Arrays - Variable Sized Object Maybe Not Be Initialized?

Oct 30, 2013

I'm trying to get a full understanding of multidimensional arrays. When I try to initialize the array I get an error.

Code:

int Pick2(void) {
int pick = 2;
int limit = 0;

[Code].....

The error I get is "variable-sized object maybe not be initialized" with warnings messages pertaining the that Error message.

View 12 Replies View Related

C++ :: How To Display Image On Output Screen

Nov 21, 2013

how to display an image on the output screen of c++ program.

I am using : Turbo c++(dos box) on win8

View 1 Replies View Related

C++ :: How To Display File With Numbers On The Screen

Apr 1, 2013

I have a file with numbers and want to display it on the screen.

View 15 Replies View Related

Visual C++ :: Enter First And Surname And Then Display Full Name

Sep 21, 2012

I'am new to C++, program is : enter first and surname and then display the full name:

code below:

// Enter first and surname and then display the full name.
#include<iostream>
#include<string>
#include<cctype>
using namespace std;

[Code] ....

View 10 Replies View Related

C++ :: Windows Form Display Error

Mar 20, 2014

I'm fairly new to visual C++ programming in a windows form and the code displayed below works fine. However my issue is as soon as the program is running it will display "failure" on label7 as soon as the button is clicked. I understand why it is doing this as "a" is not in the textbox at this time so it reads the else line and displays the message. When I enter "a" in the textbox everything works fine and label7 changes to the right message.

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "Question 1: test";
label2->Text = "A. test";
label3->Text = "B. test";
label4->Text = "C. test";

[code].....

View 4 Replies View Related

C# :: LoopUpEdit Always Display Before Form Appearing

Sep 11, 2014

Why my LoopUdEdit always display before form load, I place it in constructor. Here is my function:

public void setDataToLookUpEdit(LookUpEdit sLookUpEdit,
string sSQL, string sDisplayMember, string sValueMamber, string sCaption) {
DataTable dt = fillDataTable(sSQL);
sLookUpEdit.Properties.Columns.Clear();

[Code] ....

View 3 Replies View Related

C :: Store Data In Binary File Then Use It To Find Inverse Of Matrix Form Of Data

Dec 6, 2013

I need to find inverse of a matrix data in binary file should be used to form matrix.its not finding inverse correctly rest is working good.

Code:
#include <stdio.h>
void createbin();
void display();
void inverse();
int main()
{
createbin();
display();
inverse();

[Code] ....

View 4 Replies View Related

C++ :: Display A Table Of Numbers From 50 To 150

Apr 2, 2013

Using for loop .....

View 15 Replies View Related

C/C++ :: Read BMP Image Data Into Multidimensional Array Of Structures

Apr 8, 2014

I am trying to read the information from a .bmp file into my program while dynamically allocating memory for all of it. So I defined the structures for the headers and for a pixel, and then I have to read each pixel into a multi-dimensional array of pixels. I am completely new to structures, and definitely new to pointers combined with structures. I will have to use a filter with the information later, but right now I just want to read everything in correctly. The array of pixels will be two-dimensional -- the width by the height of the image, I guess.

Here's my code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
FILE *inFile, *outFile;
typedef struct

[Code] ....

View 4 Replies View Related

C++ :: User To Enter Decimal Value Then Display Its Corresponding Binary Numbers

Sep 13, 2013

Create a program that will ask the user to enter a decimal value (1-999999) then display its corresponding binary numbers. Repeat this process until the value entered is equal to 0. Use the following Function Prototype:

void BinCodes(int value);
Sample Input/Output:
Enter a Decimal: 35
Binary: 100011
Enter a Decimal: 184
Binary: 10111000
Enter a Decimal: 0

View 4 Replies View Related

C Sharp :: Display Google Map In Windows Form

Jun 1, 2012

I have to display google maps in a windows form. I managed to display the map in the form like this link: [URL] ...

But i have to display only the frame with the map in the form..not the whole page.

View 3 Replies View Related

C/C++ :: Program To Store Info About Students And Then Display To Screen

Oct 7, 2014

NOTES AT BOTTOM---EXPLANTION, PROBLEMS ETC. SCROLL DOWN

#include <iostream>
#include <iomanip>
#include <string>

[Code]....

I have to write a program that stores information about students and displays results (Formated). Example-

Inputs ( # of students, First and Last name of student, the gender, age, and hieght. (height inputed as inches and outputed as feet and inches))

Student 2
---------
Jett, Joan Female
100 years old 5' 7"

Ive been falling behind a little due to working late and barely having time for my school work. Coming across several issues, one being an error with GENDER (Error C4700: uninitialized local variable 'gender' used:). As well as how to format the end result, i understand that u have to use #include <iomanip>, but am confused on how to format correctly.

View 2 Replies View Related

C++ :: How To Make Tabular Format In STRUCT

Mar 21, 2013

How to make tabular format in STRUCT?

View 5 Replies View Related

C++ :: Design Image Class Which Should Work With Various Data Types (Multidimensional)

Dec 2, 2013

I have been thinking about this all day and I am yet to come up with a good solution. So, I need to design an image class which should work with various data types (int, float, double etc.) and can also be multidimensional (2, 3, 4, 5). So, what I did was generate a template image class as follows:

Code:
template<typename T, int dimensions=3>
class Image {
private:
T * data;
};

Anyway, now I have various image formats that I want to support, so the easy thing to do is create a Factory sort of object which will call eventually generate the correct image.

So I want to create various image classes called ImageType1, ImageType2 etc. which will take the input image and generate the correct Image object. However, I do not want these objects to be templated because they need to be passed from functions and be used in a generic way.

So, at run time I will need to be able to do this…

Code:
class ImageType {
public:
ImageType() {
PolymorphicImage * image = new Image<float, 3>();
}
private:
PolymorphicImage * image;
};

So, I want my ImageType classes to contain the Image object and be able to generate it with the right template arguments at run time. Is there any way to do this without having multiple specialised definitions for ImageType?

View 2 Replies View Related

C++ :: Display A Table With Seconds And Distance

Mar 4, 2014

I am trying to write a program that will display a table with "seconds" and "Distance". Where Seconds goes from 1-12 and the distance is displayed according to each second. However I am having trouble getting the distance variable to display any values. By the way I am also using a second function in this program besides main(), called FallingDistance(). Below is my code for the program so far.

#include <iostream>
using namespace std;
double FallingDistance(int, double);
int main() {
int Seconds;
double Distance=0;
int distance;

[Code].....

View 6 Replies View Related

C++ :: 2D Array That Display In 10 X 10 Table Like Format

Dec 8, 2014

My homework assignment is to create a 2 dimensional array that displays in a 10x10 table-like format after completing this assignment i must:

a) sum of each row
b) sum of each column
c) sum of every other row (vice versa with columns)
d) add diagonally
f) change the row to columns

what i have so far is

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
const int row = 10;
const int col = 10;

[Code] ....

Furthermore, what ive tried is to do total = total + x[r][c] within (for c= 0...)

But when it is outputted it continues to add the total from before (which of course is a looping error ive made)

How to add and subtract elements within arrays?

View 1 Replies View Related

Visual C++ :: Edit / Update And Display Group Of 40 Parameters On Screen

Feb 26, 2014

I need to edit ,update and display a group of 40 parameters on screen. (10 parameters per page and use of Arrow Key pad or touch screen clicks to modify value)....

For that I will need .. Parameter No . , String Name , Point Screen Cord , double value , next element no. etc I have my old code with structure and array of structure written in C. I have translated it on C++/MFC .

How can I implement Class property of c++ ?

View 8 Replies View Related

C/C++ :: Tic Tac Toe - Initialize Arrays At Zero And Output Board To Screen

Sep 13, 2014

/* This is what I have so far what i am trying to do is to initialize the arrays at zero and output the board to the screen. Part of the problem is the user has the option of the board size. All this is suppose to do is to output the board to the screen. I am having problems understanding 2D Arrays.
*/

using namespace std;
int main() {
const int BOARD_MAX = 10; // Maxinum Board size.
const int BOARD_MIN = 3; // Minimum Board size.
array = [COL];
array [ROW];

[Code] ....

View 5 Replies View Related







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