C# :: Compare One Value To A Previously Entered Value?
Oct 3, 2014
I am currently taking a C# class. Our current assignment has us entering a player name, and number of hits and displaying these in one set of labels. I have coded everything for the primary function of this program and it works. However, I also have to have a second set of labels that show the highest number of hits entered (if I enter 44, the first and second labels change to 44; if I then enter 27, the first label changes to 27 and the second stays at 44; and if i enter 55, the first label changes to 55 and the second label changes to 55) and the corresponding player name. I have tried searching and reading and I can't seem to figure out how this is done.
View 5 Replies
ADVERTISEMENT
Dec 14, 2013
I have a question about memory allocation.I have a function that calls a lot of object constructors, which in return these constructors will allocate a lot of memory.Now, in my program I am sure that if I first call this function , say it will call the constructor of 100 object.If I call this function again and again, I am sure that it will only call the constructor 100 times again, and thus I am sure that the memory allocated in the first call can be reused again.
How can I reuse the memory allocated in the first call?Can I use something like boost:object_pool so that I can tell the pool to restart from the begining and do not allocate extra memory, just use what you already have?
View 6 Replies
View Related
Dec 22, 2014
On line 128 I'm attempting to delete an image file that was previously shown in an ItemsControl, but was removed by line 126. So the image is not being shown in the program at the time I'm wanting to delete the file.
Error:Additional information: The process cannot access the file 'c:StudioExit PopupKeith Sketch.png' because it is being used by another process.
My Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
[code]....
View 10 Replies
View Related
Oct 31, 2013
I have a small questions in the behavior of Structure, I have declare a structure with 10 components. Some of the components in the structure has already their value but when I use
The structure components in a function DLL function those value I set previously has been deleted or empty. I don't know what is the problem...
View 1 Replies
View Related
Apr 6, 2012
I'm using web cam to save,update the image in base directory folder.I can save the image but, while attempting to update the image..I caught an error!!
C#.Net:
The process cannot access the file 'C:..~..inDebugcustomer_photos10.jpg' because it is being used by another process.
View 2 Replies
View Related
Jul 15, 2014
I am trying to find the max number entered by the user, and it should terminate when a negative number is entered. For my code, it will just end when the user inputs a lower number than the previous. i.e.- 10 20 15 "The highest number is 20" when it should be "10 20 5 40 15 -1" "The highest number is 40". No arrays or do/while loops either.
#include <iostream>
using namespace std;
int Max(int x);
int main() {
int x;
[Code] ....
View 9 Replies
View Related
Feb 25, 2014
A problem that lets the user enter any positive integer, but you do not have to check for this, and then calculates the sum of the digits and displays this to user. For example, if user enters 14503, the outputted sum of the digits would be 13. You need turn in an algorithm, C++ source code and output.
how do i even go about making 1 add to 4? and so on. I'm lost.
View 5 Replies
View Related
Sep 16, 2014
when i declare local variable x and use it in array,the error is occure that use of un assign local variable.
namespace ConsoleApplication11
{class Program
{
static void Main(string[] args)
{
int x;
Console.Write("enter how many entries you want");
[Code]...
View 2 Replies
View Related
Dec 4, 2014
im working on our project and this part of the project which says to add a new a room.
Details:
Open the file (ROOMS) that maintains all the ROOMS records.
Ask the user to enter the required data Room_Type and Room_Rate, then save it.
Keep asking the user (Do you want to continue?) until the user enters (N OR n), this should stop the data entry and get the user back to the main menu.
Myproblem :: i keep getting error at the bottom says my while statement is wrong " IntelliSense: no operator "!=" matches these operands"
My other problem:: how do i get back to the main menu?
so what ive done till now is.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
int choice,i=1,Room_rate;
string alphabet;
string Room_type;
[code].....
View 3 Replies
View Related
Nov 17, 2013
I have the program working but when I check if the input to make sure it is not a char it creates a infinite loop. I used an if statement to check for the issue and solve it but its not working. I even tried throwing an exception but I learned later they are not used for things like this.
Code:
#include <iostream>
#include <limits>
#include "contacts.h"
using namespace std;
int main()
[Code].....
View 10 Replies
View Related
Mar 9, 2013
I am using Dev C++ on a windows computer.
In my code, the user enters the name of a city, and then according to what city it is, the program displays the coordinates of that city
I can't find a way of figuring out and checking which city the user has entered so the code can displays its appropriate latitude and longitude.
View 9 Replies
View Related
Jan 25, 2014
Create a program that keeps on reading positive numbers until user enters a zero value, and then outputs the last positive number entered.
I do not know how to output the 'last positive number' and I do not even know am I doing things correctly so far....
Code:
#include <stdio.h>
int main() {
double num;
for(;;) {
printf("Enter a positive number: ");
scanf("%lf",&num);
[Code] ....
View 9 Replies
View Related
Nov 22, 2013
I have to make a program and how to go with it. What is excepted of me is to have a entered number, become fragmented, and then resembled.
Ex. 1394--> 1 3 9 4 --> 1394
View 6 Replies
View Related
Feb 14, 2014
So, I am making a name-database-type-thing and I want the user to be able to enter there own file. Like, here:
string fileName;
string name;
cout<<"What is your file name?"<<endl;
getline(cin, fileName);
ifstream nameFile(fileName);
getline(cin, name);
nameFile<<"Name: "<<endl;
Well, that last part is in a loop, so you can enter an unlimited number of names to the .txt file.
So, it won't let me use the string in ifstream. How can I fix this? This maybe unclear, so if it is just say so and I will edit it.
View 6 Replies
View Related
Mar 19, 2013
I am making a program that will suggest meal options when choosing specifics contained within, e.g. style, base, main, sauce.
What I would like to know is how to collect the input that has been entered by the user, say you are given 4 lists and each has an option, how could I chain these together in order to cout a suggestion that is in my database?
-------------------------------------------------------------------------------
Example (not my real Q's and A's):
OUTPUT: What meat would you like?
INPUT: "Beef" //<collect this!
OUTPUT: What sauce would you like?
INPUT: "Tomato" //<and this!
OUTPUT: What would you like to have as the main/base?
INPUT: "Pasta" //<and this!
OUTPUT: I can suggest... "Spaghetti Bolognese" //< and return this from the database using the 3 filters
--------------------------------------------------------------------------------
View 1 Replies
View Related
Sep 30, 2013
If I entered multiple cin say for variable x, how do I total them all up at the end?
Example: x being the variable.
cin 45
cin 50
cin 22
The total would be 117 but how would I write that in c++?.
View 3 Replies
View Related
Oct 3, 2013
/*
* echoString2.c
* Echoes a string entered by user. Converts input to C-style string.
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main(void) {
char aString[200];
char *stringPtr = aString;
[Code] ....
and these are my errors
212Untitled1.cpp[Error] stray '222' in program
212Untitled1.cpp[Error] stray '' in program
212Untitled1.cpp[Error] stray '222' in program
262Untitled1.cpp[Error] stray '222' in program
262Untitled1.cpp[Error] stray '' in program
262Untitled1.cpp[Error] stray '222' in program
Untitled1.cppIn function 'int main()':
2125Untitled1.cpp[Error] 'n' was not declared in this scope
View 3 Replies
View Related
Jul 28, 2014
I'm making a Project on a Travel Agency and I need to hide the password entered by the user! I am working on Xcode 5.1.1 -> Command Line Tools -> C++ on my MacBook Pro! Here is what I've tried --
string pass ="";
char ch;
cout << "Enter pass";
ch = getchar();
while(ch != 13){//character 13 is enter
[Code]...
But in the first case the display is -
//Assuming the password is Hello Hello ******
And in the second its giving me 3 errors -
1. Apple Mach-O Linker(Id) Error "_stdscr", referenced from:
2. Apple Mach-O Linker(Id) Error "_wgetch", referenced from:
3. Apple Mach-O Linker(Id) Error clang: error: linker command failed with exit code 1 (use -v to see invocation)
View 10 Replies
View Related
Jun 6, 2014
Write a program that reads numbers from cin and then sums them, stopping when 0 has been entered. Add the following to your program:
-A counter within the while loop that keeps track of the number of inputs entered.
-A comment that determines if the total value is less than 100 or greater than 100, as in the sample output
-Switch statements to determine the total number of inputs
Sample output:
Enter numbers, one per line. Enter 0 to end:
7
8
6
5
5
9
8
0
The total was 48.
The total number of inputs read is 8.
The total is less than 100.
The code that I've got so far lets me keep track of the inputs entered, and displays the total of the values, but I'm not sure how to do the part where it determines if the value is greater or less than 100.
#include <iostream>
using namespace std;
int main() {
int val, total=0;
int i=0;
cout << "Enter numbers, one per line. Enter 0 to end:
";
[Code] .....
View 2 Replies
View Related
Apr 15, 2014
I am new to c++ programming, and I wrote this program. It runs perfectly but the problem is I want the program to stop If I entered letters other than A,B or C
The code as follows:
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <iomanip>
using namespace std ;
int main() {
// Deceleration Statements
[Code] ....
View 6 Replies
View Related
Oct 15, 2014
The question I am given is this:
Given a line of words (total character number is less than 100,
start from odd position 1,
and end with newline char "
").
Write a program to reformat it that new output is formed by each char from its odd position first, then its even position char.
View 14 Replies
View Related
Oct 6, 2014
how I can ignore strings from being entered by the user. When the use enter's a string it always evaluates it as even. I though I might use a cin.ignore(); but I am unaware of how to use it.
#include <iostream>
using namespace std;
int main() {
cout << "Enter a number: ";
int num = 0;
[Code] ....
View 2 Replies
View Related
Sep 29, 2012
Converting ascii value entered by user.
How to convert it to float basic of c programming techniques only ....
View 2 Replies
View Related
Jan 16, 2012
I am experiencing some errors with my first c++ program. im getting some compilation errors that i cannot figure out.
In file included from w2.cpp:7:
Fraction.h:17: error: variable or field 'enter' declared void
Fraction.h:17: error: expected primary-expression before 'struct'
Fraction.h:18: error: variable or field 'display' declared void
and so on ..........
Code:
#include "fraction.h"
//using namespace std;
/*
int main() {
struct Fraction fraction;
cout << "Fraction Simplifier" << endl;
cout << "===================" << endl;
enter(&fraction);
[Code] .....
View 1 Replies
View Related
Aug 18, 2014
Write a program to enter the number till 100 till the user want and at the end it should display the count of positive and negative and zero entered.
View 8 Replies
View Related
Mar 25, 2014
I'm trying to code a Singly-Linked List(Double Pointers) selection sort program and I can't tell what the problem is. My compiler says no errors but when I run the program, it crashes right after I enter the values.
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct node{
int elem;
struct node* link;
[Code] ....
The compiler that I'm using is Dev-C++.
View 2 Replies
View Related