C/C++ :: Program To Right Justify Text
Mar 11, 2015
Write a program to right justify text !!! IS there a way to do without using the command setw[ ] because it dosen't seem like a logical answer. For instance can we know the end of line in the output box so that we can do view output aligned right ???
View 6 Replies
ADVERTISEMENT
Jun 5, 2014
I want to make a program that opens a text file and checks the usernames listed in the text files to see if the names are registered on a site such as twitter. How easy would this be to make, what things would I need to know?
View 4 Replies
View Related
Mar 26, 2013
Program that reads in a normal text file and converts it into mobile phone text. that is if the word is 3 characters or less then ther is no changes to the word and if the word is four or more letters then remove all the vowels from the word except for vowels that are capitals.
View 5 Replies
View Related
Jul 7, 2014
I have been tasked to interface an old piece of equipment at our facility with a laptop in the same room. The laptop is to read the data input through USB and print to a text file. The equipment uses an RS485 serial output. Is this possible to do in C++?
View 5 Replies
View Related
Apr 22, 2014
How to add text files to use in Xcode programming? I have tried to add them with no success. Is there some code I need to add to make the program read the text file?
View 7 Replies
View Related
Mar 16, 2013
I am trying to understand how to append some code to a text file. I have run a simple program like the one below. Basically it opens a text file and then it appends the string aaaaaaaaaa
Code:
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
char s[10] = {"
aaaaaaaaaa"};
[Code] .....
Now that I know how to append the above string, I now would like to extend the experiment to append the following snipped of code in my test.txt file:
Code:
<Placemark>
<name>12:01</name>
<Snippet maxLines="0"></Snippet>
<description> </description>
[Code] ....
How do I go about doing this? The problem I am experiencing is that all the / and " characters in the above snippet of code seems to get the C compiler confused. One thought I had was to create a string like the one below but as I mentioned, the number 0 in the code is surrpunded by " " and this confuses the compiler:
Code:
char s[250] = {"<Placemark>
<name>12:01</name>
<Snippet maxLines="0"></Snippet>
[Code] ....
View 3 Replies
View Related
Oct 6, 2014
I created a program in C that opens a text file and read integers.
File `numbers.txt`:
> 5 6 4 6 3 4 1
I use some restrictions with the `fscanf()` library and read the file, just for the record, and if everything goes fine I proceed to the next part of code (I know I could use `fget()`, but this is how I done it).The next part of the code will be this:
- First, I want the program to read the numbers from right to left. I look for an answer in google and many C courses, but I couldn't find a working solution. I think that the code is pretty simple, though I can't find it. **To be clear for the next part, we read the numbers from right to left.**
- Then, this is the hard part for me: I want the program to read the numbers and if the next number is higher (**not equal**) than the last one to keep it in memory, **only if it's higher than the last.** This can be continue for **1 through 500.000 numbers.**
- Then when the procedure done, I want to print how many numbers are greater than the last one and save it to a file, which I can do it if I solve the last problem.
We have the below numbers:
5 6 4 6 3 4 1
The program starts to read the numbers from right to left.Now which and how many numbers are greater than the last one?
The answer is 3 numbers:
5 6 4 [6] 3 [4] [1]
Then the program will print the number 3 with a message and save it to a file called `xxx.txt`. I am posting the `main` code, not all the code just what you need to solve the problem:
Code:
#include <errno.h> // macros for reporting and retrieving error conditions
#include <stdio.h> // load main C library function
#include <stdlib.h> // need that for many reasons ;)
#include <string.h> // loads various of characters functions
}
[code]....
In conclusion, I want 2 pieces of code:
- One to read the numbers from right to left
- One to make the above procedure
View 11 Replies
View Related
Jan 13, 2014
How do i change color of text in the program more than once . rite now i use the code
system ("color 0c");//makes the color of the text red
cout <<"hey";
system ("color 02") //change color to green;
cout<<"only in green ";
it displays both the lines in green not the first in red and second in green.
View 1 Replies
View Related
Jan 28, 2013
I want to create a program using c++ which will accept text from the user and then adds it onto a image of a form in specific locations (if that makes sense?)
and what libraries will be required?
View 1 Replies
View Related
Jan 28, 2015
i am trying to doing my project what is: Diff - The program should compare two text files and list the differences, i.e. lines and columns of the beginning and the end of a given difference.
i dont know how to start or what to do with this.
View 4 Replies
View Related
Oct 3, 2013
I need to decrypt my text file and make it able to read in my program..
What I have programmed so far is to read the encrypted file, create a new file, decrypt it and read the newly created file..
I need to decrypt the encrypted file without having to create a new file that reads the decrypted text..
Well, Let me show you my code:
P.S Most of the include is not needed and I already know that Visual studio 2010 Windows Form Application CLR
Code:
#pragma once
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
[Code].....
You have my decryption code and the code I want to use..
I have uploaded the code for you to use on your computer because it is fairly hard for me to explain..
I want to be able to read the encrypted file in my program, without having to writing a new file to decrypt it..
Decrypted & Encrypted .txt file Included (And images)
--> Program .rar pack link <--
Build it with Visual Studio 2010
View 5 Replies
View Related
Mar 23, 2013
I am working on a program that deletes same lines in a text file. I already wrote it, but it still doesn't work.
Code:
#include <stdio.h>
main(){
FILE *f1,*f2;
char oneword[100],filename[25];
int c;
long int i,j;
char *norstring[500000]; /* I count from 1 */
[Code] ....
View 3 Replies
View Related
Jan 19, 2014
Been given an assignment to create a predictive text program. What data structure I should use for this and the steps I should take when I make the program?
View 12 Replies
View Related
May 6, 2013
my program wont output any information to the text file that I have specified it just creates it but it leaves it blank
#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;
class Carloan
[code]....
View 2 Replies
View Related
Jul 9, 2013
I want to make a program that can know the current time and create a new .txt file.For example if its Monday to day then when its Tuesday it crates a new txt file called Tuesday.I really don't know how to go about this.I know i will need to use the time.h library.
View 4 Replies
View Related
May 31, 2013
I want to know how to read multiple text files in this program... I have 5 text files(order1,order2,...order5).
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<windows.h>
using namespace std;
class{
[Code] ....
View 3 Replies
View Related
May 11, 2013
I am trying this program for eliminating the vowels from a text.
#include <iostream>
#include <vector>
#include <ctype.h>
bool isVowel(char c, int indx) {
c = tolower(c);
if ((c == 'a') || (c == 'e') || (c == 'i') || (c == 'o') || (c == 'u'))
[Code] ....
Here is an error while debugging that while trying to match the argument list '(std::istream, std::string).
View 7 Replies
View Related
Apr 20, 2014
I want to create a welcome text header during the program runs. I wanna keep it at the top while the program is running (like asking for input@ showing output).
EG:
-----
WELCOME
----- //Stay until end of the program
// output/input. "WELCOME" stay at the top
View 2 Replies
View Related
Feb 5, 2014
I'm writing a code obfuscator in C. Debugger shows no errors in the code, but the program crashes after compiling -- I'm guessing it has something to do with while loops or reading data from files.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// list off all replaced elements
typedef struct ReplaceList {
char *from;// from string
char *to;// to string (random)
[Code] ....
View 3 Replies
View Related
Nov 25, 2013
I'm trying to make a program that writes words to a text. The words are generated by a brute force program. I am getting a segmentation fault 11...
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
static const char alphabet[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"1234567890";
[Code] .....
View 4 Replies
View Related
Jan 29, 2013
Basically I am to create a program that will read two saved text files; one is [2x4] ~ (matrixA.txt) and another is [4x2] ~ (matrixB.txt). The program is supposed to read both text files, multiply them, and generate an output that will be saved as ~ (matrixC.txt).
So here is my horrible attempt at it:
Code:
#include <stdio.h>
int main() {
FILE * fileA;
FILE * fileB;
FILE * fileC;
[Code] .....
And these are the compile errors...
C:UsersLeDerpHW1.c: In function `main':
HW1.c:27: parse error before `int' //Line 28
C:UsersLeDerpHW1.c: At top level:
HW1.c:34: warning: parameter names (without types) in function declaration //35
HW1.c:34: warning: data definition has no type or storage class //35
HW1.c:35: parse error before `for' //37
[Code] .....
View 13 Replies
View Related
Nov 14, 2013
I have been working on a program to read in a tab deliminated text file of xyz coordinates of atoms/particles and store the values in three seperate arrays. This is my code so far:
Code:
#include<stdio.h>
#include<stdlib.h>
void fileinput(FILE *ifp) {
int N, column, atom;
int c;
column = 1;
[Code]...
Supposedly this should assign the values in the text file to the cooresponding arrays but when I run the code on a simple test file all I get is:
Code:
$ ./input.o -i ./test.txt
Atom one coodinates x 0.000000, y 0.000000, and z 0.000000 Where test.txt is: Code: 1.0000 2.000 1.5
3.0000 5.000 1.4
4.0000 3.000 1.3
View 1 Replies
View Related
Jan 1, 2014
I am currently working out on a problem in which a c program is to be made which shows a large text file in parts.
f
For example: If file contains 200 lines. 50 lines will be shown on first page and user is asked to press any key to move to next page until EOF is found. user is allowed to return to previous page as well, and this is very complicated task for me. I tried to move cursor to a specific position using fseek etc but it page doesn't stop and reaches to end quickly.
View 1 Replies
View Related
Nov 8, 2014
I'm working on a program that reads in a .txt file and searches through the text for a keyword. If it gets a hit on the keyword, the line number where the keyword is located and the line that contains the keyword is printed out. What I have now doesn't catch every occurance of the keyword "a".
Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
[Code]......
View 4 Replies
View Related
Sep 22, 2013
I need to write a program to make the user input some text, and the first letter of each word has to be uppercase. (have to use while loops)
So for example lets say the user inputs:
i lOvE pRoGrAmMiNg
The output needs to be:
I Love Programming
Code: int main()
{
char c, lower_c;
printf("Enter Text");
while (c != '' && c >= 0)
{
if (c >= 'A' && c <= 'Z')
lower_c = c + 32;
else
lower_c = c;
[Code]...
I have started this code by making the letters lowercase (I don't know if this was the right way to approach this, ). I am not sure how proceed after this step, the step of making the first letter uppercase. (PS for the program, loops should be while loops)
View 6 Replies
View Related
Nov 7, 2014
I am writing a spell checker for a exercise for a class I am taking online. I have to load a huge text file of 143092 words into a hash table.
The program segfaults on word number 63197. Is there a way to debug this in gdb without having to step threw the function 63197 times.
View 3 Replies
View Related