How to print to the screen the value of n after it has been multiplied.
For example: if I use cout << "n: " << n << " power: " << power << " "; I
can see the variable "power" decrementing by 1, but I don't see the variable "n" incrementing with its new value after it has been multiplied by n * n.
#include <iostream> using namespace std; typedef unsigned short int USHORT; typedef unsigned long int ULONG;
class DataBase { // Change the connection path here to your own version of the database public SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=|DataDirectory|UberDatabase.mdf;Integrated Security=True;"); public DataBase() { } }
And in the same namespace as this class I have a form that calls it like so:
DataBase dBase = new DataBase(); SqlCommand trythis = new SqlCommand("Register", dBase.con);
However, I'm getting the field initializer error on dBase.con. I'm not sure why, but when I call the database from another file (program.cs) it works fine this way.
I am just now in my first programming class for learning C language and I am stuck on one of my homework assignments. I am not asking you to write the code for me or anything because I want to learn by doing it myself but all I am asking for is some pointers to where I am messing up. My program is already finished for what she asked for but I am trying to do an extra credit where she wants us to have the user decide how big the gameboard is and how many mines to hide in it. Really I know that I need to use srand() and rand() but I am not sure how to use them to randomly place mines and without placing mines on top of others.
Code:
//Program 3 "Minesweeper" by Casey Samuelson //10-17-2013 //This program will imitate the game Minesweeper. //Agorithum
For a Homework i need to make some kind of Minesweeper but i have one Probleme one of my functions always return teh same and i cannot fin out why here is the code:
bool setzen(int x, int y){ if(feld[x][y]!=3){ return mine=false; }
[Code]....
Thats the Part where Everything happens but the Function "bool setzen" always returns false and i dont know why.
Any examples of a c++ program that uses recursion to find the longest increasing sequence from a grid in a file. Like
2 4 6 8 10 12 14 16 18 20 22 24
I have to use a structure named Point and a structure named Sequence.
const int MAXROWS = 4; const int MAXCOLS = 4; const int MAXFILENAME = 255; // Structure used to define a point (x,y) in the grid. typedef struct { int x, y;
I can't get my program to print only AVAILABLE SEATS; instead it prints Both Available and Taken.
//Program allows you to delete and add seats to the Airplane. Also to upload seat settings as a text file. #include <iostream> #include <fstream> //file stream for text file #include <string> using namespace std;
I need help writing a program where I use small letter to write names in Big letters. (I dont know if you understand what i mean). Follow link to description.
i have to make two functions one recursion that ask the user to enter number of rows and i use recursion to tell him how many pins there are ex. user enters 5 there are 15 pins. I did this function now i need a function that prints an asterisk triangle for my recursion function so for 15 it should look like this
* * * * * * * * * * * * * * *
i tried many times but can't make it descend like that i can only get like a right triangle..the hard part is that it goes with the users number so if they enter 3 for example it should be 3 rows.
I use the AS/400 warehouse system, and I need to be able to automate typing one letter in several different locations to speed things up.
My thoughts are: 1. Find out how to make a program that will determine x, y coordinates of mouseclicks, and then use software to use macros to change information. 2. Build a program that will complete a single process by repeating set mouse clicks and keystrokes.
We recieve HUGE transfers from a warehouse across the country, and have to change the first character of the name of bin locations - and after a few pages it gets VERY tedious.
The program must print out 5 random numbers, from 1 to 45 and 100 different sequence.. Now I want each number of sequence to be different and not the same....
for example
1,2,3,4,5 6,7,8,9,10 .... ... ..
here is my code:
#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main () { int xRan1;
I'm trying to make a program in C where the user enters a string and it prints a word for example (name) in lowercase then the same word again but in capitals and lowercase like this (NnAaMmEe).
I'm trying to write a program that prints all of the prime numbers to the screen. I'm getting angry because it only prints EVERY number. I think it has something to do with the bool change not being able to leave the for-loop but how to fix it.
Code: #import <stdio.h> #include <stdbool.h> int main(void){ printf(" The Primes Are: 1");
I want to make a simple program that will print out the factors of an integer. My program right now only outputs "The prime factors of 221 are 221, 221, 221, 221"... Where it should be "The prime factors of 221 are 1, 13, 17, 221"
#include <cstdio> int factorsOf(int x); //function int main() { int x = 221; printf("The factors of 221 are ");
This program prints out the total number of up to 100,000. How to do is to print out the number of twin primes up to 100,000. Is it as simple as adding an if statement "if(primesList[j] - i == 2)"?
#include <iostream> #include <string> #include <cmath> using namespace std; int main() { int primesCount = 0;
I found this implementation on a website for printing the longest common subsequence. But it gives wrong answers for some reason even though the code seems right to me.
Here is the code:
#include <iostream> int lcs(char *X, char *Y, int m, int n) { int L[m+1][n+1]; for(int i = 0; i<=m; i++)