C :: Get Code To Display A Table With Values From A File
Feb 20, 2015
get my code to display a table with values from a file. my current code fills up all the sections of the table with the same data. here is what I need: from a file .txt I upload numbers that should show a table like this :
Lake Beach Average E-Coli Level
Recommendation
Ontario Kew Beach 47.12 OPEN Huron Goderich 51.13 CLOSED Simcoe Sibbald Point 0 INSUFFICIENT
my problem is in the last two columns. The ave. E-coli has one value for all which should look like the above table but my code doesn't. Also my recommendation shows the beach # instead of open close or insufficient.the data is:
Lake table
1: Ontario
2: Erie
3: Huron
4: Muskoka
5: Simcoe
Beach table
100: Kew Beach
101: Sunnyside Beach
103: Sandbanks
201: Port Dover
202: Port Burwell
203: Crystal Beach
301: Goderich
302: Sauble Beach
303: Kincardine
401: Muskoka Beach
501: Sibbald Point
the .txt file contains the following data:
1 101 5 66.6 33.3 22.2 98.9 11.1
5 501 2 33.3 44.3
now this is my code:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
FILE *in;
}
[code]......
fix the two last columns so the correct info shows like the table above.
View 3 Replies
ADVERTISEMENT
Nov 19, 2013
I am having an issue with my sort function. This is one part of the Hash table program. The main issue is that I am trying to sort the pointer table after all of the values have been entered. The ptr_sort function is not a class function and so I am therefore unable to use the class variables psize and pTable. Is there another way I should be trying this? it is a Vector should I use the sort() function from the vector class in STL?
#include "/home/onyuksel/courses/340/progs/13f/p9/util9.h"
#include "/home/onyuksel/courses/340/progs/13f/p9/hTable.h"
#ifndef H_TABLE1
#define H_TABLE1
void ptr_sort ( );
[Code] ....
View 1 Replies
View Related
Feb 3, 2015
I have to develop a C program that reads a very complex txt file (output of a calculation code, so full of mixed text and numerical tables), search for a specific table in it and individuate/print or replace a specific value with assigned position in the table.
View 2 Replies
View Related
Jul 29, 2014
I am writing a program to display values from a data file as an image. But I can only get a blue screen. Here is a small program resembling my code. what I have missed? I only changed OnDraw function.
Code:
void CColorDisplayView::OnDraw(CDC* pDC) {
CColorDisplayDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CRect rect;
[code].....
View 10 Replies
View Related
Apr 2, 2013
Using for loop .....
View 15 Replies
View Related
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
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
Feb 3, 2015
i need the output to display the product of every whole number from 1-3 in a table format.
this is the code i have so far. i know some brackets are missing but i just pasted the meat of the code. when i run the program i keep getting the number 1 displayed in a straight line going on forever
int multiply1 = 1;
int multiply2 = 1;
while(num1<=3)
{ // num1*num2;
//num1 = 0;
while(num2<=3)
{ Console.WriteLine(multiply1*multiply2);
if(num1>=3)
{ Console.Write();
}
}
num1++;
}
View 2 Replies
View Related
Feb 12, 2015
Write a program that creates and displays a table of temperature conversions. Get the starting temperature from the keyboard in degrees Celsius (do not allow input of a value below absolute zero). Also get an integer value to represent the number of degrees to increment for each of a 20 row table (do not allow the increment value to be less than one. The first column will be a row number starting with one, follow by the Celsius value and then the conversions into Fahrenheit, Kelvin, and Rankine. Be sure that all columns are neatly right aligned for a variety of inputs.
Thats what i wrote so far:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double C,F,K,R,n,a;
cout <<"Enter starting temperature in Celsius: ";
cin >> C;
[Code] ....
Thats what the instructor looking for:
Enter starting temperature in Celsius: -500
ERROR: Temp must be >= -273.15: -273.15
Enter increments in degrees Celsius: 100
# Cels Fahr Kelv Rank
1 -273.15 -459.67 0.00 0.00
2 -173.15 -279.67 100.00 180.00
3 -73.15 -99.67 200.00 360.00
4 26.85 80.33 300.00 540.00
5 126.85 260.33 400.00 720.00
6 226.85 440.33 500.00 900.00
7 326.85 620.33 600.00 1080.00
8 426.85 800.33 700.00 1260.00
9 526.85 980.33 800.00 1440.00
10 626.85 1160.33 900.00 1620.00
11 726.85 1340.33 1000.00 1800.00
12 826.85 1520.33 1100.00 1980.00
13 926.85 1700.33 1200.00 2160.00
14 1026.85 1880.33 1300.00 2340.00
15 1126.85 2060.33 1400.00 2520.00
16 1226.85 2240.33 1500.00 2700.00
17 1326.85 2420.33 1600.00 2880.00
18 1426.85 2600.33 1700.00 3060.00
19 1526.85 2780.33 1800.00 3240.00
20 1626.85 2960.33 1900.00 3420.00
Press any key to continue . . .
My question is to know how to make the sequence from 1 to 20 and whats the best statement for increment...
View 2 Replies
View Related
Aug 18, 2012
I was looking at this code:
private void button1_Click(object sender, EventArgs e)
{
string input = textBox3.Text;
[Code].....
And how to rewrite the code so that it display the MySQL table data for a specific user I already have a string called username and that stores the username entered on the login form. I want the code to use the username string to search for the name and display that users info.
My table contents are: username
First name
Last name
Position
Employee Id
Airline
View 7 Replies
View Related
Oct 1, 2014
Below, is the program I completed so far. I need to write a C program that reads in a stream of integer values, each representing an (x,y) pair on the cartesian plane. It then says I need to display the distance and direction from one point to the next. I tested it out, and it works.I need to use a conditional statement, and I'm a little confused how to display the direction(right, left, up, or down).I think I need to use an. "If" statement with my first one being something like:
If (y2 = y1) && (x2 > x1)
and I'm not sure what else to put,or if this is wrong. And with y staying the same and x increasing, the direction would be right.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int x1, y1,x2,y2,x3, y3,x4,y4,x5,y5,x6,y6; //x and y coordinates
[Code] ....
View 1 Replies
View Related
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
View Related
Aug 23, 2014
Am using the below code to INSERT values into MSI Database (Registry table)
private void button2_Click(object sender, EventArgs e) {
String Name1 = lblDName.Name;
String Value1 = txtDName.Text;
String Name2 = lblUnisntall.Name
String Value2 = txtUninstall.Text;
[Code] ....
This code work properly, but after inserting values in MSI database.
The Value1 and value 2 are created as REG_SZ (String) but as per my requirement,
Value1, should be REG_EXPAND_SZ
Value 2, should be REG_DWORD
Need to convert them in my code and then to insert into the MSI database.
View 3 Replies
View Related
Nov 14, 2013
I am trying to work with C# and i am stuck here. My problem is i want to retrieve the count of all the users in a specific side. Let me Explain. Here is my table snapshot with sample data.
Now what i want exactly is that i get the count of users in a specific side as i give a user id as a parameter.The data is stored in MS Sql Database and i have to implement this on a website so efficiency of code is also a issue.
Suppose i give 1001 as input
The output should be : Left:1 , Right: 8
if 1002 is input
The output should be : Left:5, Right:0
if 1003 is input
The output should be : Left:3, Right:0
if 1004 is input
The output should be : Left:0, Right:0
if 1005 is input
The output should be : Left:1, Right:1
and so on. how to implement this thing. I also want to get a code which would return an array of all child users of a particular ID in a hierarchical manner so that i could process that data with RadOrgChart Control.
Attached Images scr.png (14.9 KB, 36 views)
View 1 Replies
View Related
Apr 28, 2015
IM trying to make a simple program that will display morse code. Ex if you type 0 print should be (-----) and all the way up to 5. The problem is though that all printf displays all the numbers and not executing only the assigned variable.
#include<stdio.h>
int main(void) {
int a , b , c , d , e, f, x;
a = 0;
b = 1;
c = 2;
d = 3;
e = 4;
f = 5;
x = 6;
[Code] ....
View 4 Replies
View Related
May 21, 2013
Howe can i display the average of 100 values in c++ 2008....
View 4 Replies
View Related
May 10, 2013
Program works perfectly fine. I input in the length, width and height. But i want it to display those values for every individual prism when i output... along with the area and volume which i already have. Since i made a vector i won't let me cout it normally.
#include <iostream>
#include <vector>
using namespace std;
[Code].....
View 2 Replies
View Related
Feb 12, 2013
I am using pointer to display values of an array but its output is not correct example 23424,0, -323423 etc... whats the problem with my code:
Code:
#include<stdio.h>
#include<conio.h>
int main() {
clrscr();
int arr[10][10],rows,cols;
int* ptr;
[Code] ....
View 4 Replies
View Related
Jul 28, 2014
I need to display values from my array that I get from my textbox 1 into my textbox 2 with the following format:
char[0] "whatever" char[2]
void Button1Click(object sender, EventArgs e) {
string text = BIRTH_DAYW2.Text;
string [] split = text.Split(new char[] {'/'});
for(int i = 0; i < split.Length; i++)
[Code] ....
View 2 Replies
View Related
Feb 10, 2013
So I have to write a code for my C++ class, and I am having a problem trying to figure out how to get my code to read multiple int values. This is what my code should look like
Enter two times in military format (e.g., 1730 1520): 1730 1520
[1520<1730]
Enter two times in military format (e.g., 1730 1520): 1520 1730
[1520<1730]
Enter two times in military format (e.g., 1730 1520): 1730 1730
[1730==1730]
Enter two times in military format (e.g., 1730 1520): 1760 1520
1760: [INVALID TIME 1]
Enter two times in military format (e.g., 1730 1520): twelve 2
[INVALID NUMERIC INPUT]
View 1 Replies
View Related
Aug 31, 2013
1.Create one 2-dimensional array. The array will consist of numbers from 1 to 10. And will also contain the number in words. Display the values of the 2-dimensional array.
Sample output:
1 - One
2 - Two
3 - Three
Paste the program code here:
2.Create a program that will accept two integer numbers. These integer numbers will be the limit of the multiplication table. Store the values in a two dimensional array.
Sample output:
Enter x: 3
Enter y: 2
123
246
Paste the program code here:
3. Determine the output produced by the following program segment.
int ROWS = 3;
int COLS = 4;
int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}};
for (int i=0; i < ROWS; i++) {
for (int j= 0; j<COLS; j++)
System.out.print (val [i][j] + " " );
System.out.println ();
}
Write the Output:
View 6 Replies
View Related
Jun 16, 2014
How can I display my inputted values here without overwriting the other earlier inputted values. It should be displayed like this [URL].... but mine shows this [URL].... I've been stucked here for hours in thinking for an algorithm. Everything is working fine except the PDISPLAY part
#include<iostream>
#include<iostream>
#include<string>
#include<cctype>
#include<cstdlib>
#include <iomanip>
#include <windows.h>
#include<conio.h>
[Code]...
View 1 Replies
View Related
May 24, 2014
Code:
Real x = (arg.state.X.abs - mViewport->getActualLeft())/float(mViewport->getActualWidth());
Real y = (arg.state.Y.abs - mViewport->getActualTop())/float(mViewport->getActualHeight());
_trace("%f %f
", x,y);
Code:
#include <Windows.h>
#ifdef _DEBUG
bool _trace(TCHAR *format, ...) {
TCHAR buffer[1000];
[Code] .....
Results:
f f
f f
f f
f f
How to display the actual values in the console?
View 4 Replies
View Related
Feb 16, 2013
i need to display the current time and date in my program and use variable to store each of the time values like
a = 10
b = 29
c = 31
printf(``%d : %d : %d``, a,b,c);
which then give the output as - 10:29:31
How to save the time in variables in C....
i am using C in windows 7 and my complier is Bloodshed Dev C++
View 7 Replies
View Related
Feb 4, 2013
How to display the record that match for the duplicate items in a Listview. I use C# with linq queries.
View 1 Replies
View Related
Jan 25, 2013
If a user enters a string of boolean algebra it will ouput the table.
I have input parsing, cycling through the combinations, and outputing working. However once i parse the input I am not sure what to do with it. I have thought of having it write the parsed input to a new file as a function and then use that function, but that seems bad.
How to dynamically create the function, how to implement it.
BTW This is a console function, if that changes anything.
View 2 Replies
View Related