Visual C++ :: Letting User Enter A Character On Specific Line And Place?

Aug 8, 2014

How can I create in my C++ program so a user can paste a text and then choose a character on specific line and place?. The above thing isn't that important. I just want to place a character on a specific line and place.

I mean something like this:

Enter a character:

You choosed " / "

On which line do want the character?

You choosed "Line 1 and 2"

Where do you want the the to appear on the line? (left or right)

You choose left.

Results:

Line 1. / hello

Line 2. / hello

View 8 Replies


ADVERTISEMENT

Visual C++ :: Prompt User To Enter Integer Value And Character Code To Indicate Conversion

Sep 14, 2013

I'm expected to write a c program for this question :

Using these header files
#include <stdio.h>
#include <conio.h>

Question : Write a program that will prompt the user to enter an integer value and a character code to indicate whether they want to do a Kilogram to Pounds conversion (A) or a Pounds to Kilogram (B) conversion. Note that 1 kg = 2.2 pounds. The program should then do the necessary conversion indicated by the code and display the newly converted value to the screen.

View 1 Replies View Related

C/C++ :: How To Ask A User To Enter Date And ISBN Number In Specific Format

Dec 4, 2014

I don't know how to ask the user to enter the date in this format (DD/MM/YY) and ISBN number with hyphens.

After user enter date and ISBN number, it should look like this:

Date: 5/24/12
ISBN: 0-000-12345-0
#include <iostream>
#include <string>
using namespace std;
int main() {
string date;//MM/DD/YY Format

[Code] ....

View 7 Replies View Related

C :: Prompt User For Input And Display Character In Every Line

Mar 17, 2013

I am having problems printing "->" on the beginning of each line, im trying to do it as a loop and ending it when the user types "q". also i would like to know how to ignore text from the user when the input begings with a specific character. heres what ive done so far, and not currrently working as expected.

Code:
#include <stdio.h>
int main (void) {
char prompt;
printf("~~~ FRACTION CALCULATOR ~~~

[Code] ....

View 1 Replies View Related

C++ :: How To Make Specific Character Show Up Specific Amount Of Times

Mar 5, 2013

How do I make a specific character show up a specific amount of times?

Like I am generating a random number then I need to make "|" show up that many times on the screen.

View 1 Replies View Related

Visual C++ :: Program To Output A Line For A Specific Age Group - CPP File

Feb 13, 2013

I am suppose to make a program that will output a line for a specific age group,but everytime I execute the exe file it gives me the desired line and also the last line included everytime.Where did I go wrong with it including the last line everytime?

#include <iostream>
using namespace std;
int main() {
double age;
cout<<"Enter your age:";
cin>>age;
if (0<age && age <6)

[Code] ......

View 1 Replies View Related

Visual C++ :: Enter File Name By Keyboard Instead Of Command Line Arguments?

Mar 10, 2013

Actually the below program is for Dispersal Algorithm called Rabin-IDA; this algorithm divided the data into N pieces and then recombine it from M pieces (such that M<N).

Thus, the below program needs command line arguments,which entering by Project properties/Debugging. this argument is file name, where the program performing spitted the file into N files, and then recombine it from M divided files, and put it on another file which should also passing its name as argument .

Now my question is, How can i make this program enter the file name by keyboard??(i mean enter the files name by user from screen not as command line arguments) ... In another word, How I can exchange ?

Code:
argc == 3
and
Code:
argc == 2

To enter file name ? i mean what i should do to in

Code:
rabin.split(argv[1])

To pass my file name by use keyboard not Project properties/Debugging?)

the below code is just the main function of program, and the whole of it in this link [URL] .... Information Dispersal Algorithms Rabin-IDA.

Code:
#include "include.h"
void __cdecl _tmain(int argc, TCHAR *argv[]) {
DWORD ini=GetTickCount();
try {
if( argc == 3 ) //recombine

[Code] ....

I know I should use getline() function but how exchange argv[] ?

View 1 Replies View Related

Visual C++ :: Allow User To Enter A Value As C String In Certain Form

Oct 14, 2013

My program was to allow the user to enter a value as a C string in the form: xxx,xxx,xxx,xxx,xxx.xx, where x can be any digit. Well, so far here is my attempt. I think the question is, would I have to implement a switch statement for the digits, the comma, and the decimal, so that when a user inputs, let say 52,000.00 the switch statements would read the 1st digit, checks for decimals/commas and if not, proceed to read 2nd digit, and repeat?

Code:
#include <iostream>
#include <string>
int main() {
using namespace std;
char buffer[256];
char tempBuff[256] = {'

[Code] ....

View 3 Replies View Related

Visual C++ :: Create A File That Ask The User To Enter His Info

Nov 9, 2014

What I want to do is create a file that will ask the user to enter his info,n then store it in a text file The screen will ask the user if he wants to update his info. if he says yes then the screen will be cleared and the old info will be printed on the screen. The user will enter his new info that will be stored in a new file. My problem is that once the user finishes entering his input the program just closes D: and the rest of the program won't run.

Code:

int main()
{
string ans;
ofstream Xfile("original.txt");
cout <<"Enter your name and address please"<<endl;
cout<<"Press Ctrl+Z+Enter when you are done"<<endl;
string name_and_street;

[Code]...

View 3 Replies View Related

Visual C++ :: How To View Line Length In Cm To User (using Map Mode)

Nov 3, 2012

My program allow user to draw lines and the user should know the length of the line that he draw in centimeter (.cm)

I did use

SetMapMode(MM_LOMETRIC) function to convert the device units into logical units

and it works correctly but I don't know how the line length will appear to the user to let him draw in correct length

I think to make the length appear on the mouse when the user draw but I don't know how I calculate and display it.

View 2 Replies View Related

C++ :: How To Search For A Specific Character In A String

Feb 4, 2015

i'm doing a validation exercise program. Just a question, how do i search an inputted string for a certain character?

For example:

Hello.World

I wanna determine and find out the where the '.' sign is.

I'm doing an if-else conditions, i need to determine where the character is located and make sure it doesn't repeat.

View 4 Replies View Related

Visual C++ :: Ask User To Enter A Sentence And Then A Word To Be Searched For In Sentence

Oct 9, 2013

I am trying to write a program that ask the user to enter a sentence and then a word to be searched for in the sentence. The program must then search for the word in the sentence in a loop and continue to output each place the word is found. For example if the sentence is : I like pickles, pickles, pickles

and you searched for pickles it would return pickles found at 7, pickles found at 16, pickles found at 25.

I am having trouble writing the equation to make the find keep searching after each occurrence of the word being searched. Here is the code I have so far

HTML Code:
#include <iostream>
#include <string>
using namespace std;
int main() {
string paragraph;

[Code] ....

View 5 Replies View Related

C :: ROM BIOS Programming - Accept Row Number From User And Place Cursor To The Beginning Of That Row

Nov 27, 2013

How do I write a ROM BIOS routine which accepts a row number from the user and place the cursor to the beginning of the row number which the user gave?

View 2 Replies View Related

C++ :: Creating Infinite Sheet On Which User Can Write Notes And Place Images

Dec 31, 2012

I'm new to c++ and I want to create an infinite sheet on which a user could be able to write notes and place images. Any GUI library that I could use to do that?

View 2 Replies View Related

Visual C++ :: Search Function - Ask User To Input Name And Brings Out Line From TXT File Containing Information

Dec 8, 2013

How to get this thing to work. All i need to do is ask user to input a name and then it brings out the line from the .txt file containing the information.

For example in my case I'm doing a member search function I'm required to ask user to input the name of the customer and then print out all the details (which consumes 1 text line in the .txt file)

Here is the code, This is the write to text file method (100% working)

Code:
cout << "Customer Name: ";
cin >> name;
// ...
ofstream myfile("customer.txt", ios::app);

[Code] .....

View 3 Replies View Related

C/C++ :: Infinite Loop If Enter A Non-numberic Character

Jul 28, 2014

it will produce the answer above..when user enter a nonnumberic character it will force the user to reenter again

do
{
cout<<"Min of the secret number : ";
cin>>min;
}while(cin>>min);
cout<<"Max of the secret number : ";
cin>>max;

this is my coding but it will auto jump out when i enter non-numberic character

View 1 Replies View Related

C++ ::  Going To A Specific Line Through Ifstream

Jan 12, 2015

I want to access specific lines in a "*.txt" file. I've heard of seekp() and what not, but don't know how to call them as such.

View 6 Replies View Related

C++ :: Bezier Curve - How To Extract Control Points From A Specific Character

Jun 12, 2013

I need to know how can i extract control points from a specific character. (this case is it possible?). So, more specifically, i have a specific character, let 'a' this character. So what i need, is how to extract control points from this character in order to draw it as a bezier curve.

View 3 Replies View Related

C++ :: Determine Number Of Times Change Each Specific Character In String To Make It Palindrome

Feb 19, 2015

I'm trying to determine the number of times I have to change each specific character in a string to make it a palindrome. You can only change a character one at a time from the end.

Example: "abc" -> "abb" -> "aba" should print 2. "aba" will print 0 because it's already a palindrome. "abcd" -> "abcc" -> "abcb" -> "abca" -> "abba" will print 4 because it took 4 changes to make a palindrome.

I'm not too sure how to approach this - I figured out the case where if it's a palindrome (if reversed string is the same) then it'll print out a 0.

int main() {
int number;
cin >> number; //expecting a number for first line user input
for (int i = 0; i < number; i++) {
string str;

[Code] ....

View 1 Replies View Related

C++ :: Processing Large Files - Getting A Specific Line

Jul 5, 2012

I am reading in some large files to process. The files need to be parsed into multi-line sub units for processing (by a different physical process). My current setup is crude and parses the entire file into memory before beginning to process the sub units. This is fine as long as the file fits, so I get into trouble > 2GB or so when my machine flat runs out of memory. The simple thing to do is to only read in some of the file, process what was read in, and then read in more. I more or less know how to stop reading at some point in the file, but I'm not sure how to resume from that point later when I need more data. Is there a way to count lines and then getline() starting from a specific point in the file? From reading the getline() doc, it doesn't look like there is.

This is my current function,

Code:
void ParseFile(char *path, char type) {
// open input file
ifstream input_file(path);
if( !input_file.good() ) { cerr << "Failed to open " << path << endl; exit(ERRCODE_ERROR); }
int pos = 1;

[Code] ....

I need to remove the code to open the file from this function and open it elsewhere. I would like to call this every time I run out of data, if( tasks.empty() ), and get more data from the input file, but I don't know how to resume reading the input file from where I left off.

If this is not possible, I guess I would have to place a function call in while( input_file.good() ) to call out and process the data I have. When the current tasks list is finished, the list could be cleared and control returned into the while loop to continue reading input and start re-populating the list.

View 2 Replies View Related

C# :: StreamReader And StreamWriter - Overwriting Specific Line In A File?

Apr 10, 2014

I am currently working on a small project, which is an ATM simulator but, lately, I've been stuck in a part where I have to overwrite a specific line in a .dat file to update the account's checking and savings balance, once the transaction has been done. I have to use StreamReader and StreamWriter to complete the task and I have also being told to try Collections... which I'm not sure as to why.

Here's my code so far:

private void btnOKd_Click(object sender, EventArgs e) {
int transaction = 0;
atmTIMER.Elapsed += new ElapsedEventHandler(timerRESTART);
FileStream fileTRANSACTIONS = new FileStream("C:\Users\Voyage\Desktop\ATMSim\ATMsim\Transactions.dat", FileMode.Open);

[Code] .....

View 14 Replies View Related

C/C++ :: Delete Specific Line In Text File Using Program?

Feb 6, 2014

Some codes to delete a text in a specific line in a text file.

Example:
This is line 1
This is line 2
this is line 3

Removing line 2,

This is line 1

This is line 3
//////////////////

View 2 Replies View Related

C++ :: Enter By Keyboard Instead Of Command Line Arguments?

Mar 9, 2013

Actually the below program is for Dispersal Algorithm called Rabin-IDA; this algorithm divided the data into N pieces and then recombine it from M pieces (such that M<N).

Thus, the below program needs command line arguments,which entering by Project properties/Debugging. this argument is file name, where the program performing spitted the file into N files, and then recombine it from M divided files, and put it on another file which should also passing its name as argument .

Now my question is, How can i make this program enter the file name by keyboard??(i mean enter the files name by user from screen not as command line arguments)

The below code is just the main function of program, and the whole of it in this link (http://www.juancamilocorena.com/home/projects) Information Dispersal Algorithms Rabin-IDA

#include "include.h"
void __cdecl _tmain(int argc, TCHAR *argv[]) {
DWORD ini=GetTickCount();
try {
if( argc == 3 ) //recombine

[Code] .....

View 4 Replies View Related

C++ :: How To Enter And Print X And Y Coordinates On One Line Separated By Comma

Nov 22, 2014

I'm trying to enter an 'x' and 'y' coordinate on only one line separated by a comma. But I keep getting a syntax error. Here are the lines of code I'm using. This has to be simple. What am I doing wrong with this code?

Code:
cout<< "Please enter the x and the y coordinates of the first point,"<<endl;
cout<< "use a comma to separate them. " <<endl<<endl;
cin>> "You entered: " >>x1>>",">> y1 >>"for the first point" >>endl;

View 7 Replies View Related

Visual C++ :: Place Binary Array Into And Then Retrieve From Registry

Feb 12, 2013

I have used the following code to attempt to place a binary array into and then retrieve from the Registry. I am a member of the local Administrator group. I have verified that the Registry for the app has a binary array 32 bytes in length under the key "settings" / "keyb" ab 12 cd ...

Code:
// in header
unsigned char m_key[32];
int m_nKeySize;
// in implementation
// int ctor
AfxGetApp()->GetProfileBinary(_T("settings"), _T("keyb"), (LPBYTE*)&m_key, (UINT*)&m_nKeySize);
// in OnDestroy
AfxGetApp()->WriteProfileBinary(_T("settings"), _T("keyb"), (LPBYTE)&m_key, m_nKeySize );

Here is a copy of the binary array in the Registry:

7D DE 2B 30 E7 06 12 AC 99 60 8C 26 21 FC 8E 5B 66 DB 72 9E A2 00 BE 15 E1 8B 67 31 E5 EC 8B 15

Here is the binary key retrieved from the Registry using the code above:

D0 EB 26 00 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC

View 7 Replies View Related

C :: How To Prevent Fgets From Reading The New Line Character

Mar 12, 2013

i am trying to read a string using fgets and storing in an array i want to prevent fgets from storing the new line character on the array using the shortest means possible..

View 2 Replies View Related







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