C/C++ :: How To Save New Input Using Output

Sep 11, 2012

I have a project, a montly paycheck. So it checks the monthly paycheck of each employees. but my problem there is how to add a new employee when u are a user or in the output of program?

View 2 Replies


ADVERTISEMENT

C :: Save Output From Ansi Escape Sequence To Variable

Apr 13, 2013

I'm trying to get the current position of the cursor in the terminal window. I know that the ansi escape sequence "33[6n" will display the current x and y location of the cursor. But what I can't figure out is how to store the x and y locations into their respective integer variables.

This is what I've done so far:

Code:
#include <stdio.h>
int main(void) {
int line, column;
char cursor_curr_pos[9];
char escape_sequence[] = "33[6n"; //outputs x and y location of cursor e.g. ^[[18;1R
snprintf(cursor_curr_pos, 9, "%s", escape_sequence); //save output to string
sscanf(cursor_curr_pos, "^[[%d;%dR", &line, &column); //only read numbers from string
}

View 2 Replies View Related

C++ :: Program Save Input Data?

Feb 14, 2014

Can any C++ or C program save input data?

View 3 Replies View Related

C++ :: Save Variable From User Input?

Jul 30, 2013

I'm having trouble trying to save a variable from an input of the user. Then use it when i start up another .exe.

If it makes any difference I am using dev c++. I'm using the input as an a or b so some one will put a for english or b for spanish. after that I want to use that info in another if statement of another .exe.

View 1 Replies View Related

C :: Get Text From Input And Save Each Word With Malloc

Dec 19, 2014

I want to write a program which takes a text from input and saves each word with malloc. For example for text "Have a nice a day" i want an array for each word, have,a,nice etc.

View 1 Replies View Related

C/C++ :: Input Float And Integer And Save It To Txt File

Mar 20, 2014

i am writing a program that requires me to write am input a float and an integer and save it to a txt file. When i try to compile my code i get an error "assignment from incompatible data type". ?

int *intconstant;
float *floatconstant;
int *value;
struct FILE *infileptr, *outfileptr;
infileptr = fopen("/home/brinkmann.brendon/assign14data.txt", "r");
outfileptr = fopen("/home/brinkmann.brendon/assign14report.txt", "w");

[Code]...

View 14 Replies View Related

C Sharp :: Data Save But 2nd Record Doesn't Save

Jan 28, 2015

1st when i fill the things on form then saved in database after saving record when i want add another record it shows an error. after saving it saves new record refresh doesn't work

View 1 Replies View Related

Visual C++ :: Unable To Save File Using Cfiledialog Save As In MFC

Nov 5, 2013

I am trying to develop a GUI using MFC, but I am having trouble using CFiledialog to save a file. The problem is, the file is not getting saved to the folder when I use the CFiledialog. Below is the code I am using.

Code:

CString szFilter = "XNRep Files (*.xnrep)|*.xnrep||";
CString s = "xnrep";
CString t = "";
CFileDialog fileDlg(FALSE, s, t, NULL, szFilter);
if(fileDlg.DoModal() == IDOK)
{
std::ofstream file;

[Code]....

After the file dialog opens up, I enter the name of the file and select OK button. But the file does not show up in the directory I am saving to.

View 4 Replies View Related

C :: Redirecting Input And Output

Sep 14, 2013

I have this code:

Code:

#include <stdio.h> //printf
#include <stdlib.h> //exit
#include <unistd.h> //fork
#include <sys/types.h> //pid_t
#include <sys/wait.h> //waitpid
}

[code]....

I would like to, when running cat, send in some data like "testing" to its stdin, and then catch the output of stdout, and put it into a character array variable.Currently the parent stalls till the child is done.I imagine the parent has to some how detect that the child executed 'cat', and then send in input to stdin?Then somehow detect that 'cat' is done executing, and read the output from stdout? I have looked around and found "dup2", but I don't understand how to send in and get data to the child from the parent, especially since the "file descriptors" is not pointing to any files in the first place..

View 4 Replies View Related

C++ :: Audio Input / Output?

Feb 5, 2015

So I have a project in which I am processing audio signals in real-time. I want to create a class to do this using the ASIO driver. I don't want to use a cross platform library nor do I want to use windows API as it is very slow.

View 2 Replies View Related

C/C++ :: Console Input / Output?

Sep 7, 2014

I'm trying to write something that when a user is at the command line, the user can type and it displays of list of commands the user can use to run the application.

View 14 Replies View Related

C++ :: Zero And Output The Input With A Setprecision Of 2

Mar 31, 2013

I have a program that needs to output the input with a setprecision of 2 but when it outputs 0, it has to be "0", not "0.00"

How will I go about that?

Here is my code:

void PrintAllSales(double sales[][SLSPRDT]) {
cout << fixed << showpoint << setprecision(2) << endl;
cout << "ALL SALES
";
WriteLine('=', 63);

[Code] .....

And here is how it comes out:

1234
ALL SALES
===============================================================
Product # | 1 | 2 | 3 |
Salesperson 1 | 2000.00 | 0.00 | 299.00 |
Salesperson 2 | 0.00 | 2543.98 | 95.99 |
Salesperson 3 | 0.00 | 0.00 | 19.99 |
Salesperson 4 | 0.00 | 3854.75 | 0.00 |

But it should be like this:

1234
ALL SALES
===============================================================
Product # | 1 | 2 | 3 |
Salesperson 1 | 2000.00 | 0 | 299.00 |
Salesperson 2 | 0 | 2543.98 | 95.99 |
Salesperson 3 | 0 | 0 | 19.99 |
Salesperson 4 | 0 | 3854.75 | 0 |

View 7 Replies View Related

C++ :: String Integer Value - Input / Output

Aug 14, 2013

Code:
Prompt the user to input a string,
and then output the sum of all the digits in the string.

Sample Run 1:
Input -> A111B222C
output -> 9

Sample Run 2:
Input -> ABC123XYZ32100000005555555555zzzzzz
output -> 62

View 1 Replies View Related

C++ :: File Input And Output Structure

Jul 17, 2013

How to structure the input of one .dat file and outputting into another one. I have to loop through a file structured "doe, john, 1500", check for errors and then increase the mp by 50. You also have to do this through using a person class too. I think I need to use a while loop to go to eof and use getline to input correctly, but im not sure how to structure it.

Data file:
Horowitz,Jake,1200.24
Flabitz,Bubba,1712.38
Blackwell,Sharon,1872.93
Molerat,Rufus,501.00
Goodall,Jane,1567.43
Sommerset,William,1359.57

[Code] ......

View 4 Replies View Related

C :: How To Arrange Input / Output Order

Sep 22, 2014

for our school project, we have to make a program which involves three students and the prices each of them paid for the meals. The program has to calculate how much each of the students has to pay/receive to/from the others. Most of it, we got from our teacher. The error we are getting is that we have to 'take care of the input/output order'. So if you type in the names/numbers of the students in a different way, so for example if you type first number 1, then 0, then 2 and 0 and 1 have to pay money to number 2, number 0 has to be in front of 1. Our output is that number 1 is in front of number 0.

insert
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

[Code].....

View 1 Replies View Related

C++ :: Get Input From Ports And Send Output

Jul 30, 2014

I'm learning C++. Is there some way to make program function on input from a port like usb port and can I send bits through the port? For example A usb cable connected to a circuit. I press a button and an AND gate on the circuit gets activated by a bit from the usb port and a fan in the room turns on.

View 1 Replies View Related

C++ :: Assigning Input To Value - Random Output

Jul 24, 2014

I'm using getline, and stringstream to assign an input to a value. How to do something similar with a random output.

//Battle with Samer
#include <iostream>
#include <string>
#include <sstream>
#include <ctime>
#include <cstdlib>
using namespace std;

const char* PokemonSamer[6] = {
"Charizard", "Umbreon", "Mew", "Arcanine", "Espurr", "Luxaray"

[Code] ....

When I run <PokemonSamer[rand() % 6]>, I want to be able to save whatever that output may be, and save it to <string Samer>. Is this possible?

View 6 Replies View Related

C++ :: String Input AND Output To File

Sep 15, 2013

I'm trying to write a simple program that will prompt for a string typed in by keyboard and save it to a file. I've tried lots of variations and this is just the latest version.

//Prompt for a string input by keyboard and save it to a file

#include<iostream>
#include<fstream>
#include <string
using namespace std;

[Code] .....

View 2 Replies View Related

C++ :: Input And Output Array Using Function

Apr 25, 2013

I want to create a function that will accept input from the user and return the input, to be used for further calculation. I know how to accept and return with integers as parameters , but how do i do it with arrays?

Suppose there is an array of numbers arr[]. Now, i want a function that accepts the input from the user, and return the array for further manipulation.

For example, if the array is arr[5], then i should call a function and accept the values from the user. Then, i should return the imputed values and print the same. How can i do this.

View 3 Replies View Related

C++ :: Merging Input And Output Files

May 2, 2014

Write a program that opens two text files (input1.txt and input2.txt) for input and one for output (output.txt). The program should merge the two input files in the output files. While doing the merge, it will read one line from input1.txt and one line from input2.txt and write those in the output file one after other. Then it will read the next line from input1.txt and next line from input2.txt and write them one after other in the output file.

This is my code:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ofstream myproject;
myproject.open("input1.txt");

[Code] .....

I need to:

1. how to get the second line in the input1.txt file and so on.
2. After the writing in output.txt, count the number of lines in output.txt.
3. write the number of times term ‘line’ appears in output.txt file.

View 3 Replies View Related

C++ :: Console Input And Output At The Same Time

Mar 4, 2014

Alright, so to better myself with network logic I've decided to make a small net game.

I need to input commands to the console as well as output status updates at the same time. I'd prefer to write a gui interface for that, but I'd rather work with WinAPI as little as possible (I mean, look at the way it's designed...).

I'd like to do this with standard operations, limiting dependencies is a must for me.

View 6 Replies View Related

C/C++ :: Output Is Not Correct - Squaring Input?

Feb 6, 2015

Ok so This is what the output of the program should be.

enter the count of input integers: 1
The count of the integers must be two or more. Please enter a valid number : 3
Enter integer #1 : 2
Enter integer #2 : -1
Enter integer #3:5

The positive numbers entered and their squares are:

2 4
5 25

My Code :

//header files
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<math.h>

[Code].....

View 6 Replies View Related

C/C++ :: Overloading Input / Output Operator

Dec 24, 2014

#include <iostream>
using namespace std;
class Date {
private:
int month, day, year;
public:
// class constructors can be overloaded
Date(int m, int d, int y) {

[Code] ....

Actually ,I'm not sure whether my understanding of operator>> function is correct. Here is my understanding of operator>> function.....

operator>> function takes Date object as argument from main function and it reads data from the console using istream(This is all I know about istream) into the new Date object which is created by operator>> function..

This is all I know about operator>> function...I really don't know why it has to return istream reference(I know the return type is istream, but other than that ? I want to know why operator>> function creates new Date object ? It already has a reference to Date object ....why not simply set the values of the already existing Date object instead of creating one..?

View 4 Replies View Related

C/C++ :: Console Input / Output Operations

Oct 27, 2012

How we can write coloured text to a text file in c? Can I use cprintf funtion with any kind editing

View 1 Replies View Related

C++ :: Input Date - Output Day Of The Week

Apr 3, 2013

I'm just starting coding and I just want it to input a date, then output a day of the week.

Code:
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int startday = 0, sm = 1, sd = 1, sy = 2000, cm = 0, cd = 0, cy = 0;
cout << "Please enter the current month, day, and year: ";

[Code] ....

View 1 Replies View Related

C :: Simple Decimal Input To Binary Output

Jun 22, 2013

I am learning c because I want to get back into programming microcontrollers, which I previously did in assembly. I wanted to make something fairly tight in terms of program memory and RAM to show me an output in binary form. When you are troubleshooting a file register or serial interface when you can see the actual bit values (on a small LCD for a micro-controller) and compare it to a datasheet.

Code:
#include <stdio.h>
#include <math.h>
int main() {
int i;
int decimaltoconvert;
int convertingarray[7];
int convertingarray2[7];

[Code] .....

Also, how might I go about putting that into a function that I could call?

View 6 Replies View Related







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