C++ :: Using String To Update Array
Jun 13, 2013
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;
int Superior[4][6]={0};
int Economy[6][8]={0};
[Code] ....
What i want is key-in 2 diff seat ID and age and cout this 2 diff seat ID and age.
View 2 Replies
ADVERTISEMENT
Apr 25, 2013
This for loop replaces the stars ******** in an array that contains a word to be guessed with the correct letter (c) that the user inputs if the word contains that letter.
Problem: After every guess the same hidden string of stars ******* is displayed instead of ex: ***W**** (assuming W was entered by the user)
How can I update the old ******** string in the Stars array with the new string that includes the correct letters chosen, so after every correct guess at a letter in the word a new string is displayed including the correct letters chosen?
I'm pretty sure I have to use strcpy but not sure how to implement it using a loop.
Code:
for(i = 0; i < strlen(unscrambledWord); i++) {
if(unscrambledWord [i] == c) {
Stars[i] = c;
} }
View 1 Replies
View Related
Apr 7, 2013
I want to do this but do not know exactly how to do it:
Create an array of space ship objects and write a program that continually updates their positions until they all go off the screen. Assume that the size of the screen is 1024 pixels by 768 pixels.
I have begun to write a bit code but the problem is when you want to see the space ship moving step for step on the screen I do not know how to create the ship visible so you can see it is moving. Here's my code so far
Code:
#include <iostream>
using namespace std;
struct SpaceShips
{
int x_coordinate;
int y_coordinate;
[Code ......
View 4 Replies
View Related
Oct 19, 2014
Very new to programming, and I know that there must be another way on inputting a string into each array cells not by just inputting it one by one, but as a whole. My code at the meantime is: [URL]
View 1 Replies
View Related
Nov 19, 2013
I just i would like to know how to record a string from a label to an array string ?
string[] stringArray = labelone.Text
View 1 Replies
View Related
Jun 11, 2012
is there a way to tell WPF that I'm going to do a lengthy update on a control (TextBlock), and that it shouldn't redraw it until I tell it I'm done? I'm adding a large number of items to the Inlines property, and it has to redraw the entire control every time I add an item, which takes a very long time - about 1 second for every 100 items. I know some other frameworks allow freezing of certain controls, but I haven't been able to find anything in the documentation or on google. I've tried collapsing the TextBlock, and then making it visible again after the update, but it did not improve the performance at all.
View 6 Replies
View Related
May 25, 2014
I am doing a remake of the classic game: Frogger. Currently, I have the world set up, the frog moves about in the world how I want it to, but I cannot get the cars or the logs to move simultaneously with the frog. I have posted my source code on GitHub.
[URL]
View 16 Replies
View Related
Sep 1, 2014
Am trying to update the MSI database via a transforms (MST) file. using below code.
WindowsInstaller.Installer inst = (WindowsInstaller.Installer)new Installer();
Database instDb = inst.OpenDatabase(MSIFile.FullName, WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeReadOnly);
instDb.ApplyTransform(MSTpath, MsiTransformError.msiTransformErrorViewTransform);
WindowsInstaller.View view1 = instDb.OpenView("INSERT INTO `Registry`(`Registry`,`Root`,`Key`,`Name`,`Value`,`Component_`) VALUES('" + Registry1 + "', '" + Root + "', '" + Key + "', '" + Name1 + "', '" + Value1 + "', '" + Component + "')");
view1.Execute(null);
view1.Close();
instDb.Commit();
When i try for MSI database before including instDb.ApplyTransform(MSTpath, MsiTransformError.msiTransformErrorViewTransform);
it worked fine for MSI, the values got updated in the MSI database, But i face error in the above line of code.
View 3 Replies
View Related
Jun 29, 2014
I have a label on my main form. When I menu select my settings form, I make a change to the label text on the main form but the label text does not update with the new text.
So here is my code in my settings form:
MainForm frm = new MainForm();
frm.paintMainFormThemeTitle(logoText); // updates the main form label
I may not fully understand the new instantiate key word, but doesn't this create another, new copy of my main form to operate on? And isn't that why I can't see my label text change on my main form that is previously in view?
All of the examples that I have been able to find show using this new key word to be able to access a component on another form. But to my understanding, I'm creating another, new form.
View 5 Replies
View Related
Feb 1, 2015
I am currently just trying to update a record in a SQL database.I can add a record and delete a record just fine but when I go to update I get no errors but it just doesn't update.
Here is what I have and done coding for hours trial and error
private void btnAddProd_Click(object sender, RoutedEventArgs e)
{//validate method // product = new Product(txtProductName.Text, Convert.ToDecimal(txtProductCost.Text), txtProductType.Text);
product = new Product();
MakeProduct(product);
if(modify) {
Product theOneAndOnly = new Product();
[Code] ....
View 1 Replies
View Related
Jul 22, 2014
I'm making a text editor for my own programming language and I wanna make a simple software updater for it.
View 4 Replies
View Related
Mar 19, 2013
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[Code] .....
View 3 Replies
View Related
Nov 3, 2013
How do i go about updating a specific record in sequential File using a primary key in c++. I used Inventory number as my primary key..
Code: int locate[2];
string fname, lname, add, name, address;
int num, foundit;
Customer customer;
[Code].....
View 6 Replies
View Related
Jan 21, 2013
Ive got a football league program that I made to handle 10 teams. Ive got the 10 teams and it displays the league with 0 for played, won, drawn, lost and points but im having trouble actually adding matches to this? How do i add matches and update the team struct?
View 4 Replies
View Related
Feb 6, 2013
Is there a way to simultaneously update two variables, like in Python?
For example
Code: x, y = 0, 1
x, y = y, x + y
View 3 Replies
View Related
Jun 15, 2013
i have given a project for currency conversion program with add,delete,search,display option. but i was thinking if it can update the currency rate from internet at beginning.
View 3 Replies
View Related
Feb 22, 2015
Im trying to make a Tic Tac Toe board for an assignment. Right now it compiles fine but when I enter an x or o it does not update the board it just prints out the '.'s that the board is initialized to. Also, when I get to player 2 the board will printout twice so its 6 rows or 3 columns. The project uses a main to ask who starts then goes to a play function that asks for inputs and calls the makeMove function to place the x's and o's and the print function to display the updated board.
bool Board::makeMove(int rowIn, int columnIn, char currentPlayer) {
if (playBoard[rowIn][columnIn] == '.') {
playBoard[rowIn][columnIn] = currentPlayer;
return true;
[Code] ....
View 14 Replies
View Related
Mar 24, 2014
I have the following code. I am able to call data from my database and print the result onto datagridview. However, if I happen to edit some data through datagridview, I would like it to save the changes by clicking a save button. I do not know how to connect callDBButton_Click and saveButton_Click...I know how to update the changes if I just put adapter.Update(dataTable); at the end of the callDBButton_Click method...but I want to it only save changes when I CLICK the "Save" Button.
private void callDBButton_Click(object sender, EventArgs e) {
string stockName;
stockName = stockNameTextBox.Text;
OleDbConnection Connect = new OleDbConnection(OleDbConnectionString);
[Code] .....
View 4 Replies
View Related
Sep 2, 2013
I'm trying to make dynamic status bar. How? I will create class, where will be function add(const string text, T value)
How it should be it in code which I want.
std::vector<string, T> cont;
void add(const string text, T value) {
cont.push_back(text, value);
} int ex = 1;
add("Example", ex);
ex = 12;
for(int i = 0; i < cont.count(); i++)
std::cout << cont[i]; // print "12"
View 7 Replies
View Related
Apr 21, 2015
In my project i need to update the attn_dateTimeOut in database.After i updated it will automatic delete the specific row record that had been updated. I had two question:
1) in my database there are a few table is assign not null."attn_dateTimeOut" is a table that haven insert any record. When i update it using below code,it work and can update but it comes out error.Error show "record cannot be null".
2) I want t make it when i updated the "attn_dateTimeOut",it will auto delete the row of updated record.I do usign back code "DeleteRecord" but it nothing change!How should i do?
Here my code:
private void txt_proximity_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == (char)13) {
TMPB_attn row_TMPN_attn = BusinessLogicLayer.TMS_GET_PROXIMITY_VALID_TO_USE(txt_proximity.Text);
if (!String.IsNullOrEmpty(txt_proximity.Text)) {
[Code] .....
View 1 Replies
View Related
Feb 14, 2015
I have a data grid view
ProductID|Name|Category|Description|quantity
1|Coat|men|black coat|5
2|Jacket|men|green jaacket|2
3|Pillow|Home|white|10
a user can edit quantity ie productID 1 has quantity 10, and ProductID 2 has quantity 3, it should update once clicked update button. however i must highlight both rows to do it so if i leave the selected cell on product id 3 it will upate only that row. is there a way to update the rows that have been changed when not highlighted.
for (int i = 0; i < dataGridView1.SelectedCells.Count; i++) {
int selectedrowindex = dataGridView1.SelectedCells[i].RowIndex;
DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex];
string a = Convert.ToString(selectedRow.Cells["Quantity"].Value);
string b = Convert.ToString(selectedRow.Cells["ProductID"].Value);
//update to database.....
}
View 5 Replies
View Related
Jan 27, 2014
This is my code as following
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
[Code]....
I have driver table this is my fields as following
DriverID INT
DriverName nvarchar50
Nationality nvarchar50
Address nvarchar50
I have form driver have 4 texbox
textbox1 DriverID
textbox2 DriverName
textbox3 Nationality
textbox4 address
this table have two records
when i press buton next (NextBtn_Click)to go third record it not accept I need next button increase by 1 if record not exist and update this in table How i do this example if i have two records
1 aln american newyork
2 adam british british
when i press next button it ok work in records exist but when i press next button to third record it not accept why what i need is when press next after 2 it come 3 in text box driver id and update this number in table
View 1 Replies
View Related
Jul 23, 2014
i'm trying to update multiple table values with same column using one query.
Here's what i've tried so far:
mySql.CommandText = "Update tbl_employees,tbl_emp_additional_info,tbl_allocated_deductions,tbl_benefits,
tbl_cashadvances,tbl_deduction_history,"+
"tbl_dtr,tbl_empabsences,tbl_empstatus,tbl_otherdeductions
,tbl_ots,tbl_payroll_history,tbl_rdcomments,tbl_reversed_deductions,tbl_reversed_deduction_paid "+
"set tbl_employees.emp_id=@newemp_id,tbl_emp_additional_info.emp_id=@newemp_id,tbl_allocated_deductions.
[code]...
I've also tried removing all the other "and" operators but still no luck.It doesn't throw in exception yet it doesn't update my tables column values.
View 14 Replies
View Related
Oct 28, 2014
I am trying to create an application interface serial data reception using c #. I send the data from the serial adc microcontroller adc atmega 16 ... the data is 0 to 1023. In the textbox that I use as a data reception, data updates to the bottom if I use ReadLine coding.
examples:
1023
1023
1023
256
669
If I use ReadExisting, the data displayed by the textbox moves to the side. examples 102310231023256669
When the data changes from 0-1023 of serial communication, and clear the data will store in otomatiis in the textbox.
When there is reception of data with a value of 1023 and immediately there is a change to the value of 555 textbox value will not store the value of 1023, I want the value in 1023 immediately deleted automatically and change the value to 555 when a change in the value of the data ...
The following is the complete source code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace serial {
public partial class Form1 : Form {
[Code] .....
View 6 Replies
View Related
Oct 21, 2014
It's my understanding that there are three ways to go about updating a control on a form from a class.
A) Instance the form, eg: Form1 Frm = new Form1();
The problems I have run into with this is that while writing text to a richtextbox using the instance Frm, the richtextbox never updates on the form.
B) Passing the object to the class.
This method seems less used and can be very problematic. Haven't looked into it thoroughly.
C) Exposing the objects using classes within the Form.
While making methods public they still do now show as available for use when calling from classes, unless I instance them but then I run into problem A. I've considered making the methods static so no instancing is required but when doing so the object(in this case richtextbox) becomes invalid due to itself being instanced by the automatically generated code when adding the object.
I know there is another way to pass values then force the object to update but that won't necessarily work with a richtextbox as you have the option to deal with color and font variations.
I imagine I'm missing something pretty simple here but I can't find any resources online about how to handle objects with more complex data than just straight text.
Example of problem A
//called from a class
Form1 Chat = new Form1();
Chat.BeginChat();
Chat.AddChat(Color.Lime, "Testing");
Chat.EndChat();
[Code]....
View 14 Replies
View Related
Sep 12, 2014
I retrieve all the row values from database into text box.But I could not Update it.It shows error message is : The variable name '@value' has already been declared. Variable names must be unique within a query batch or stored procedure. Must declare the scalar variable "@keyValue".
my code is here:
public partial class ECB_ECBConfiguration : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
DataTable dt = ECBDal.GetECBConfiguration();
foreach(DataColumn col in dt.Columns)
[Code] ....
View 1 Replies
View Related