C/C++ :: Final Output Needs To Print Initial And Final Values

Jan 28, 2015

I have a program that is reading six characters from a text file, swapping every other character(ABCD would read BADC), and then adjusting their value based on a user's adjusted value input. If the adjusted value is 5 then letter A becomes F.

The final output line should print the initial six characters followed by the final six characters after the swap and encrypt adjustment.

I can only manage to print the final characters. Am I far off thinking I need to use pointers to point to the original character values?

One more thing: instructor wants us to complete this project as simply as possible meaning without the use of arrays, loops, switch statements, etc.

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main() {
//declarations
char c1,

[Code] ....

View 4 Replies


ADVERTISEMENT

C/C++ :: Array To Only Print Out Final Average And Final Maximum Score With Final Minimum Score

Aug 27, 2014

#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];

[Code] ....

I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...

Minimum and maximum scores are displaying 0.0

And it displays these things 4 times in a row i just want it to be displayed once.

View 1 Replies View Related

C++ :: Constructing Random Text Generator - Final Output

Nov 26, 2013

I am constructing a random text generator and i am almost done i just need final output. Here is my coding

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;

const int NUM_FRIENDS = 5;

[Code] ....

This is how the output is supposed to look like

Program Output

== Who Should I Text? ==
Enter seed
Enter friend 0
Enter friend 1
Enter friend 2
Enter friend 3
Enter friend 4
You should text: Cat

These other friends didn't make the cut:
Adam
Bill
Damion
Edward

I can't figure how to output the remaining names.

View 3 Replies View Related

C++ :: How To Make A Class Final

Oct 5, 2013

Just mark the destructor final: [URL] ....

Well, sort of - my question is, since the destructor has to be virtual in order to be marked final (you get an error otherwise), does this cause virtual function overhead anywhere, or add a vtable?

View 9 Replies View Related

C/C++ :: Reading Final Line Of File?

Mar 6, 2014

finding the last line of the code? I have a program with two functions that open and display a joke.txt and punchline.txt file. My joke function (which reads the entire file) works fine. The punchline function, however, does not.

void displayPunch(fstream &file)
{
char ch;
string fileLine;
bool isLine = true;
file.seekg(0L, ios::end);
while(isLine)
{
file.seekg(-1L, ios::cur);

[code]....

The file, punchline.txt, has a bunch of garbage strings with one real string at the end. I need extract and display only the final line of that file.

View 5 Replies View Related

C++ :: How To Make A Class Non Inheritable Without Using Keyword Final

Apr 13, 2013

how can I make a class non inheritable,,, without using keyword "final" ?

class A
{
//
};
A obj; // No error
class B : public A
{
//
}; // error

View 2 Replies View Related

C/C++ :: Display Final Results Of Grade Calculation

Sep 14, 2014

I had to write a simple program that prompted the user for various test scores and it would pump out his grade average at the end. I did that with no issue, however, my instructor wants me to add something to the end off the code and I'm not sure how to do that. My code is:

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
string tempType;
float SumTest, MaxTest, TestAve,ProgAve,output;
[Code] ....

And this is what I'm supposed to add, the averages are supposed to have numbers from what the user gave.
***************************
Grade Calculator

Program Average
Test Average

Final Grade
***************************

View 6 Replies View Related

C++ :: How To Create Final Executable File That Can Upload For Users

Feb 16, 2013

I develop a software using QT 5 open source IDE. Now my question is two-fold:

1. How can I create the final executable file that I can upload for my users? I understand that runtime DLLs shall be required and I have tried Enigma Virtual Box software for bundling runtime files. It does create the file that I can execute from any folder in my PC. However, surprisingly when I transfer that "boxed" file to another PC, it does not run. Both the PCs have Windows 7 installed on them.

2. Secondly, I see possible future issues with Antivirus Softwares. Apparently when I try to run the boxed exe file, it gets rejected by the Antivirus Software on my PC. Is there a way in which I can get my exe file verified/checked/registered by the Antivirus Softwares so that my users don't face any problems in executing the program.

I cannot afford the QT commercial licence, but I am prepared to buy any economical "setup file generating" software (if it exists).

View 1 Replies View Related

C++ :: Program That Compute Final Average Grades Of Class

Jan 28, 2013

An instructor needs you to write a program that will compute the final average grades in her class. There are 5 students in the class. Each student must take 2 exams and 4 quizzes as part of their final grade. The weight of each toward the final grade is as follows:

Exam 1 – 30%
Exam 2 – 30% Quiz 1 – 10%
Quiz 2 – 10%
Quiz 3 – 10%
Quiz 4 – 10%

You must use arrays to store each students 3 digit ID number, exam scores and quiz scores. A multi-dimensional array is mandatory. Request from the user the information needed then output all of the information as well as the final average grade for each student.

View 1 Replies View Related

C/C++ :: Calculate Cost From Wholesale To Final With Percentage Markup

Apr 15, 2014

Program calculates cost from wholesale to final cost with percentage markup!

#include <iostream>
using namespace std;
int calculate_retial(int,int);
int main () {
int wholesale;
int markup;
int cost;

[Code] ....

View 5 Replies View Related

C :: Program To Calculate Final Value Of Investment Made In TSX Market Linked GIC

Feb 20, 2013

Write a C program that calculates the final value of an investment made in a TSX Market Linked GIC.

Specification

The return on this type of GIC (Guaranteed Investment Certificate) is based on the initial investment, the number of years (1, 2 or 3), a minimum return rate, a maximum return rate, a participation rate, the values of the TSX (Toronto Stock Exchange) index at specified intervals during the years, and the type of averaging of these values. The final investment value can only be calculated once all the TSX values are known.

If averaging is not used the TSX rate is determined from the opening and closing values only. If averaging is used the TSX rate is determined by calculating the TSX average at 6 monthly intervals, then is based on this average relative to the opening value. The TSX rate is then multiplied by the participation rate. If this new rate is below the minimum rate, then the minimum rate is used, and if it is above the maximum rate, then the maximum rate is used. Rates are printed to 2 decimal places, and the final investment is rounded down, and formatted using commas.

Only round down for the final investment. If the TSX rate is negative do not print the line for rate adjusted for participation. Assume that the final investment is less than one million dollars. (Hint: if you need to print leading zeros in a number, use the %0m.n format: example - the format specifier %06.2f prints 4.56 as 004.56)

Example 1: See below; averaging is not used, so TSX rate = (107-100)/100 = 7%. After using a participation rate of 80%, get 5.6% (which is between min & max rates).

Example 2: See below; averaging is used over 5 values to get a rate of 68% which equals 54.4% due to participation. This is more than the max rate, so the max rate is used.

The GIC calculator must use the following layout exactly.

+------------------------------------+
| TSX MARKET LINKED GIC CALCULATOR |
+------------------------------------+
Enter initial investment : 1000.00
Enter number of years [1,2,3] : 3
Enter minimum and maximum rates [%] : 1 20
Enter participation rate [%] : 80
Enter if averaging used [1=yes,0=no]: 0
Enter open and close values : 100 107

TSX rate . . . . . . . . . . . . . . 7.00%
Rate adjusted for participation . . 5.60%

Final investment . . . . . . . . . . $ 1,056.00

+------------------------------------+
| TSX MARKET LINKED GIC CALCULATOR |
+------------------------------------+
Enter initial investment : 2000.00
Enter number of years [1,2,3] : 2
Enter minimum and maximum rates [%] : 1 20
Enter participation rate [%] : 80
Enter if averaging used [1=yes,0=no]: 1
Enter 5 TSX values : 200 190 320 430 540

TSX rate . . . . . . . . . . . . . . 68.00%
Rate adjusted for participation . . 54.40%
Maximum rate is applicable . . . . . 20.00%

Final investment . . . . . . . . . . $ 2,040.00 i wrote something like

Code:
#include <stdio.h>
int main (void)
{
int years, minimum, maximum, partrate, x, open, close, tsxvalue;
float investment, tsxrate, y, finalinvestment, maxrate, minrate;
printf("+------------------------------------+

[Code] ....

I don't know what the exact calculation should be here now to get the rest....so I'm stuck here

View 2 Replies View Related

C++ :: Two Dimensional Array - Calculate Final Scores Per Diver Who Each Get Five Dives

Jan 31, 2014

I have to create a program that calculates the final scores per diver, who each get five dives. I have to include the difficulty level when figuring out this score, and I need to drop the highest and lowest scores.

Now, I'm reading from a file where the values are something like:

234 :Diver number
2.3 :Difficulty
2.1 3.2 4.0 2.3 3.8 :Scores

Would I create a parallel array for the difficulty, or include it in a 2D array with the scores. Something like

score[Difficulty][individualScores]; ?

Also, would I include a findMin and findMax in a function that calculates the total, seeing as how the highest and lowest must be dropped to determine the final score?

View 11 Replies View Related

C++ :: Program To Call Relevant Functions To Calculate Final Price

Sep 14, 2014

I want this programming to call functions choose between a customer type and call the relevent function to calculate the final price but it is not calling the functions.

#include <iostream>
using namespace std;
double amount;
double studendOrPensioner(int&choice, double &origPrice);
double OtherCustomers(int&choice,double& origPrice);

[Code]...

View 1 Replies View Related

C++ :: User Input Data About Percentages To Calculate Final Grade - Addition Error?

Sep 15, 2014

I am trying to code a program that takes in user inputted data about percentages and using it to later on calculate a final grade. 4 percents are inputted, for Assignments, Midterm1, Midterm2, and Finals. If the percents dont add up to 1 (i tell the user to enter the decimal value) I set up and if statement to catch it and end the program. Except that if i type in

Assignments = .3
Midterm1 = .3
Midterm2 = .3
Finals = .1

the program doesn't recognize that they add up to 1. Heres the relevant portion of my code [URL] ....

Here's some examples of how it works [URL] ....

And heres what i dont understand [URL] ....

Why is it saying .3 + .3 + .3 + .1 != 1 when .1 + .3 + .3 + .3 == 1?

View 1 Replies View Related

C++ :: Recursive Function - Prompt User To Input Base And Exponent Then Generate Final Answer

Oct 31, 2014

I am studying about recursion by myself and i want to make a recursive function that prompts the user to input the base and exponent and generate the final answer .

#include<iostream>
using namespace std;
int recursive(int x, int y);
int main() {
/*int total=1;
int y, x;

[Code] .....

View 4 Replies View Related

C :: Calculate Final Grade By Adding 4 Numbers Minus Lowest Grade And Dividing By 3

Apr 7, 2013

I'm writing a program to calculate a final grade by adding 4 numbers minus the lowest grade and dividing by 3. My knowledge in c is not extensive I thought that a simple assigment operator would do the job but I'm getting a strange large numbers in the execution.

Code:
#include <stdio.h>
#include <stdlib.h>
main(){
int eg, g1, g2, g3, g4, fg, s1, s2, sg;

[Code] ....

View 4 Replies View Related

C :: How To Know Which Number Is Approximate The Final Number

Oct 29, 2014

I have two numbers and a number that is final number. Which number is approximate the final number ?

For example:

Our final number is : -1/2 and the two numbers is 4 and 3. How can I compare it ?
Or i have numbers more than two like 5 number or 7 number or so foth numbers and final number is : -1/2

View 7 Replies View Related

C# :: Update Initial Values Once User Has Added To Inventory

Apr 10, 2015

I am having some trouble creating a listbox in visual studio. I declared an array, set initial values, and now I would like to be able to update those values. It is a pizza inventory app, so I need to update the initial values once the user has added inventory. This is the code I have for the "Update Inventory" button:

// read in value and convert to double
double dblInput = Convert.ToDouble(txtInput.Text);
// loop through ingredients and add inventory to selected ingredient
for (int i = 0; i < dblInventory.Length; i++) {
// is item at i checked for update?
if(lstInventory.GetItemCheckState(i) == CheckState.Checked)

[Code]....

View 11 Replies View Related

C++ :: Read Unknown Number Of Integer Values And Then Print Count Sum And Average Of Odd Values

Apr 9, 2014

write a c++ program that reads an unknown number of integer values and then print count, sum and average of odd values, even values, positive values, negative values!!

View 1 Replies View Related

C/C++ :: How To Print Output To Array

Nov 10, 2014

At the bottom I have a loop that cout FI,XC,XL,I while going through the loop but when it prints its uneven and setw cant fix it. How do I print values of FI,XC,XL & I to an array so they are aligned.

#include <iostream>
#include <string>
#include <cmath>
#include "projectfunctions.h"
#include <iomanip>
using namespace std;
const double PI=acos(-1);

[Code] ....

View 4 Replies View Related

C++ :: Need Cout To Print Function Output?

Nov 16, 2013

Finally got to functions. Made a simple one that adds two numbers:

Code: int add(int a, int b){
cout<<"a+b=";
return a+b;
}

It refuses to give an output unless I use cout.

If I just call the function like so: "add(12, 24);", shouldn't it print out a+b=36? It only prints out "a+b=", unless I use "cout<<" ahead of the call.

My simple question is why does it need cout ahead of the call? Shouldn't "return" do its job and print out the number?

View 2 Replies View Related

C++ :: Print Last Digit Of Number Output Always Become 6?

Oct 26, 2013

i just started learning programming and i just wanna know how come when i try to print the last digit of a number the output always become 6?

View 4 Replies View Related

C :: Output Does Not Print On Text File

Jul 19, 2013

In this program I can not print the typed value in the file. The file creation well done but it is an empty file

I press Ctrl +z for EOF

Code:
#include<stdio.h>
int main(void){
FILE *fp;
char ch;
fp=fopen(" Test.txt","w");
printf(" Enter the TEXT

[Code] .....

View 1 Replies View Related

C++ :: Print Out All Input Values

Mar 16, 2013

I have a problem with how to print out all the numbers that the user enters the code looks like this so far:

Code:
#include <iostream>
using namespace std;
int main()

[Code] ....

I want the program to print out all the numbers that the user has entered after the program have said the higest and lowest number is ?. But I do not know how to do this I thought it could be something like this:

Code:
cout << input[0];
//or
cout << input[i];
/*

Because i is the number of how many enters of numbers the user can do*/ But that was totally wrong tried to do another "for loop" in the first for loop but that was meaningless because it can't change anything in the first "for loop".

View 7 Replies View Related

C# :: How To Print The Datagrid Values

Nov 20, 2014

I want to print the current grid values while clicking the print option ..

View 7 Replies View Related

C++ :: Make Output Print Out To Screen In Reverse?

May 26, 2013

How can I make the output print out to the screen in reverse?

Code: #include <iostream>
#include <iomanip>
using namespace std;
int getnum();
void Fibonacci(int n);

[Code].....

View 7 Replies View Related







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