C# :: Write Five And Convert To Int
Jun 10, 2014i'm using TryParse to convert 5 in string to 5 int but i want to give the possibility to the user to write five not 5.
View 5 Repliesi'm using TryParse to convert 5 in string to 5 int but i want to give the possibility to the user to write five not 5.
View 5 RepliesI'm building a Console class(i realy need it). and i don't understand how can i build the Write() procedure. Heres the structure:
write(varname1[,varnamex])
how can i convert it to cout?
Code:
// declare child arrays
public string[,] childcolor;
public string[,] childgeneo;
// create dictionaries
public Dictionary<string, int> colors = new Dictionary<string, int>();
public string color; // name for dictionary
public Dictionary<string, string> geneo = new Dictionary<string, string>();
[Code]...
I'm getting "field' is used like a 'type' error on jw.childcolor which causes other parts to error out.
How do I fix this & why am I getting the error?
I want to convert the dictionaries to arrays to read & write sequentially.
Write a program to convert the time from 24-hour notation to 12-hour notation and vice versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations. Furthermore, your program must contain at least the following function: a function to convert the time from 24-hour notation to 12-hour notation, a function to convert the time from 12-hour notation to 24-hour notation, a function to display the choices, function(s) to get the input, and function(s) to display the results. (For 12-hour time notation, your program must display AM or PM.)
Answer:
#include <iostream>
#include <iomanip>
#include <cmath>
[Code]....
It is showing error because may be I was not able to put that if statement inside any function. find out the error sand complete the program with corrected code.
Code:
template<class T>
class Convert {
T data;
public:
Convert(const T& tData = T()) : data(tData)
[Code] ....
Why do we use operator? Is float and double function names below?
Code:
Convert<int>::operator<float> float();
Convert<int>::operator<double> double();
I know I need <math.h> and I know how to write tan(10) or whatever I need. However I need angles, like 100 / tan10 = 567.13. The 10 is degrees.
I am doing a fun project now that I feel more confident. However my textbook only shows me how to use the math library and only shows a few trig functions.
I am applying Trigonometric Functions to see if a car is speeding.
For instance Code: int counter;
counter =0;
FILE *pfile;
pfile= fopen("g:myprog.txt" "w");
while (counter >100)
{ fprintf (case counter{something})}; how do I do this?
I can only write one value to file:
get all, say for example barcode
char* bst:: get_bar(hwareItem*& root){
while(root!=NULL){
get_bar(root->left);
[Code]...
gets only one value depending on traversal orderI wish to get all values of BST
I am trying to display my name using outfile vs. cout and I get errors I don't know how to fix. Here is the code:
//This program will calculate the monthly payment, the total amount paid back over the entire life of the loan,
// and the total interest paid over the life of the loan.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main() {
ofstream outfile;
[code]....
And here are my errors:
1>z:csci207program1practice.cpp(13): error C2297: '<<' : illegal, right operand has type 'const char [16]'
1>z:csci207program1practice.cpp(13): warning C4552: '<<' : operator has no effect; expected operator with side-effect
I was following a c# book to write a WPF with a textbox. When the textbox is selected(got focus) with keyboard or mouse, it will select all text in it. I followed the book and wrote this:
private void TextBox1_GotFocus(object sender, RoutedEventArgs e) {
TextBox1.SelectAll();
} private void TextBox1_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
var control = sender as TextBox;
[Code] ....
The book said having "e.Handled = true" is to stop the event in order to prevent the cursor being positioned on somewhere of the text instead of selecting all text. From my understanding, "e.Handled = true" is for stopping routed events. Is this means that something will run if "e.Handled = true" is not there? If yes, then what is it?
i am having some trouble with a piece of code im writing for class.
here is my code
for (j=7; j>=0; --j){
putchar((name[i] IF_STATEMENT);
write(1, " ", 1);
I am trying to use write to format my output so that it looks like this
0 0 0 0 0 0 0 0
The formatting works fine when i use printf("%s", " "); in place of write but for some reason when i use write the format comes out like this
00000000
I dont understand why this is happening. Does write always work outside of a for loop or something?
#include <iostream.h>
#include <conio.h>
int main ()
{
cout << "Hello World";
getch();
return 0;
}
In the above code, why is it necessary to write getch() and return 0? What is their purpose?
so i have this dll with a DBTProc, whenever a window gets created i want to write something in a log file. Now everytime I run it it adds three times the text in this log file, but then it does nothing anymore. I do hear a beep everytime a window get created so it doesn't actually open my file to write in
code:
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code < 0)
{
[Code].....
I captured .ppm from avi file. How can I convert .ppm into .jpg only using C.
View 3 Replies View RelatedI was assigned a problem involving using buffer overflow to access a different function than I was supposed to. I was able to figure out how to modify the point in stack that I need to change using a printf statement, however what doesn't make sense is that when I use the input "AABBCCDDEEFFGGx86x64x00x00" the stack changes to 78363878 I looked up the ascii codes and I assume that it's not converting x86, but using the input x86 instead.
View 4 Replies View RelatedI just started by defining a stack class (stackDouble). I need to write a program that accepts an infix calculator expression, with the following operators (**, exponentiation, /, division, and, -, subtraction. The operator precedence is exponent, division, and subtraction.I need to use a stack of doubles and a stack of strings, of which I can write two classes, or write a single stack template. The user will input the expression just via cin, and there will be a # before every number, a ! before each operator, and a . at the end of the expression. '#', '!', or '.' can be input into a char variable, numbers into a double variable and operators into a string variable.
For example, the following would output 6:
# 3 ! / # 2 ! / # .5 ! ** # 2 .
As stated above, I already made up a stackDouble class. What would I need to do to create the other class (I don't think I want to do it with a template)?
Code:
#include <iostream>
#include <string>
using namespace std;
class stackDouble{
[code]....
How can I erase the data stored in /tmp/a.txt after every run of this code?
Code:
#include <stdio.h> // IO operations
#include <unistd.h> //for pid, ppid, fork functions
#include <sys/types.h> //for pid_t type, kill function
#include <stdlib.h> //for exit function
#include <signal.h> //for kill function
#include <sys/types.h>
#include <sys/stat.h>
[Code]...
How would one write 3^i without using .math? (i being numbers 0-9)
More specifically, this is what I have:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int x, n, answer1, first;
x = 3;
n = 10;
first = 1;
[Code]....
And this is what I want it to produce:
1 0 1.0
3 1 0.333333343
9 2 0.111111112
27 3 0.037037037
81 4 0.012345679
243 5 0.004115226
729 6 0.001371742
2187 7 0.000457247
6561 8 0.000152416
19683 9 0.000050805
I believe I am only having troubles with the first column,
How can i upgrade my program I want to input a octal and binary number and convert them in base 2, 8, 10, 16..
how can I write the scanf with the right parameter in it??
Code:
scanf ("%x",&i); Code: #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main() {
int i;
char buffer [33];
[Code] .....
I have a batch of .pdf files (~1000) with names 001.pdf 002.pdf ...etc. Still pretty new to C, but would it be possible to write a program that would open a PDF, prompt a new name from user, and when entered, close the .pdf and open the next one in the list?
View 14 Replies View RelatedMy program needs to receive data continuously from one process and the received data is read continuously by another process.But when I am trying to create a pipe using mknod on fat32 file system in linux , it throws an error saying "mknod: operation not permitted".
View 3 Replies View Relatedwrite an algorithm using stack to determine if an input of string is in the form xCy where y is the reverse of x.x and y are strings of A and B. eg : AABACABAA
View 8 Replies View RelatedMy problem is :
Code: numbers[10]={25,27,17,19,47,3,98,5,124,10};
You write a program at do below processes for above array.
You want a number 1 between 10 at user.
if user enter N value,program write to screen lowest N. number at array. For example user enter 2,program write to screen lowest secondary number of 5 value at array or user enter 10 value,program write to screen maximum number of 124 value at array.
But write the program with don't use sorting algorithm.
I need to develop a tool to compare geometric structure of point cloud from scanned objects with their CAD model. The CAD model is stored in step file. So how could I extract geometric information from step file? I am totally new for CAD.
View 6 Replies View RelatedI am trying to write to external file in GCC. So far I can get to this:
#include <iostream>;
#include <fstream.h>;
using namespace std;
int stream (int argc, char* const argv[]) {
ifstream in ("mcp.strings");
[Code] ....
I need to know if I am using the correct method to choose file name. And how to set a script(double) variable to print input text or choose an on/off (0|1) input to be written to a text file.
Any links to flags (i.e. pointers and how to use them).
How do you write a default constructor?I need to use a default constructor that will initialize the data members:
- salesPerson to “Unknown”
- noOfWeek to 13
- amount to point to an array of thirteen 0.00s.
This is my weeklysales class
class WeeklySales {
char* salesPerson;
double* amount; // Pointer to an array
int noOfWeek; // Size of the array
};
Here's my attempted code:
//default constructor
WeeklySales (){
salesPerson="Unknown";
noOfWeek = 13;
amount = 0.00;
}