C :: How To Simultaneously Update Two Variables Like In Python

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


ADVERTISEMENT

C++ :: Function Does Not Update Class Variables In Recursive Call

Dec 14, 2014

I'm trying to implement Tarjan's Strongly Connected Components Algorithm in C++. Here's how I gotten so far:

void tarjan(vector<Vertex>& G){
index = 0;
while (!S.empty()) S.pop();

[Code]....

Here's an example graph for the algorithm to run: [URL]

Here's the first part of the output of the program: [URL]

all the index & lowlink values of the nodes are set to -1 in the beginning. global index value is set to 0. My problem is, the algorithm starts running on Vertex X-4. It runs the instruction X-4.index=0 & X-4.lowlink=0 then it calls itself with the paramater of node X-1. it sets X-1's index & lowlink values to 1. then it calls itself for X2. then it checks whether node X-4 has the index value <0 or not. Even though we set the value of X-4 to 0 in the first run, it still sees X-4.index as -1.

View 1 Replies View Related

C++ :: Can CPP Code Run Slower Than Python

Aug 8, 2014

I coded a problem in python. Later i thought i should write it in cpp to make it faster. It is basically a decision tree learning problem. But to my wonder, cpp code is running slower than python code. Cpp takes 1 hour to produce the same results that python produces in 6 minutes! I am making extensive use of vectors, sets and strings. Can it be due to that? I have coded the exact same logic in both languages! I am not able to conclude why is this happening!

View 19 Replies View Related

C++ :: How To Code And Implement Algorithm Using Python

Apr 6, 2014

I'm attempting to write the maximal clique algorithm for use with an adjacency matrix.I'm following a video which explains how to code and implement the algorithm using python. I want to write it for c++. URL....I'm currently trying to code the powerset function at 2 minutes into the video. I'm not sure if I should be using arrays or not.

So far I have coded the below but I dont know how to return an empty array inside an empty array (when the elts list is of size 0). I wrote an isEmpty function for the array since I cant use len(elts) like in python.

bool empty = true;
bool isEmpty(int elts[]) {
for (int z=0;z<10;z++) {
if (elts[z] != 0) {
cout << elts[z] << endl;
empty = false;

[code]....

The code should use either an array/list/vector that we call 'elts' (short for elements). Then firstly, it should add the empty list [], then the rest of the power set (all shown in the video).So for example, in the case that elts = [1,2,3,4], my code should return:[ [],[4],[3],[4,3],[2],[4,2],[3,2],[4,3,2],[1],[4,1],[3,1],[4,3,1],[2,1],[4,2,1],[‌​3,2,1],[4,3,2,1] ]

View 2 Replies View Related

C++ :: How To Create N Matrices Of Dimension (n,k) Simultaneously

Feb 27, 2014

I would like to create N matrices of dimension (n,k) simultaneously. Lets say for example that N=3. I read the command a[n][k][N] but I don't understand how to use it.

I know that for some of you this question is silly but I' m new to this language and I have noone else to ask.

View 1 Replies View Related

C++ :: Simultaneously Assign Value To Struct Members?

Feb 25, 2013

If I have a struct of some vector members, like

struct {
vector<double> a;
vector<double> b;
vector<double> c;
// ...... continue
} struct_test

How can I assign a value (push_back()) to all the vector members simultaneously, instead of do it one by one?

View 6 Replies View Related

C++ :: How To Create N Matrices Of Dimension Simultaneously

Feb 27, 2014

I would like to create N matrices of dimension (n,k) simultaneously. Lets say for example that N=3.

I read the command a[n][k][N] but I don't understand how to use it.

View 3 Replies View Related

C Sharp :: How To Print Two Or More Printers Simultaneously In One Computer

Jan 18, 2014

I have two or more printers and one computer. I want to print to both printers the same document at the same time... Thus when I press print on my document both printers will print the file simultaneously.

View 6 Replies View Related

C# :: WPF Freeze Control During Update

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

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 View Related

C++ :: Get Two Objects To Update At The Same Time?

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

C# :: Unable To Update MSI Database Using MST

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

C# :: Update A Label On Another Form?

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

C# :: SQL Update Not Updating But Can Add - No Errors

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

C/C++ :: Software Dll Update Checker?

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

C Sharp :: How To Do Update To AccDB

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

C++ :: Update Records Using Sequential Files?

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

C :: How To Add Matches And Update Team Struct

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

C :: Currency Conversion Update From Internet

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

C/C++ :: TicTacToe Board Won't Update - Prints Twice

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

C# :: Update Changes In Datagridview With Save Button

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

C++ :: Update Container Value On Element Modify?

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

C# :: Update Then Delete Record In Datagridview

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

C# :: Update Loop In Unbounded Datagridview

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

C# :: Increment Records By 1 And Update In Table?

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

C# :: Update Multiple Tables In One Query?

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







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