C/C++ :: Output Numbers From Set Of List That Were Not Used

Mar 24, 2014

This is one part of my program, I need a loop that checks through the input(specifically the agent numbers) and then outputs the agent numbers that aren't in the input, from 1 to 20(because there should only be 20 agent).

My input is :
1 3 250.00
2 0 0
15 1 1000.00
3 4 300.00
12 2 500.00
1 2 300.00
3 4 115.00
21 3 400.00
-1 4 250.00
15 1 200.00
9 5 -150.00
18 2 140.00
13 2 550.00

the first numbers are the agent numbers so 1 , 2 ,15 are agent numbers and out output for agents who didnt participate are : 2 , 5 , 6 , 7, 8, 9, 10 , 11 , 14 , 16 , 17 ,19 20

This is the code:

void not_part() {
ins.open(in_file);
int i=0;
int sum=0;
cout<<"AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN"<<endl;
cout<<fixed<<showpoint;

[Code] ......

View 11 Replies


ADVERTISEMENT

C++ :: Output Numbers From A Set Of List Not Used

Mar 25, 2014

This is one part of my program, I need a loop that checks through the input(specifically the agent numbers) and then outputs the agent numbers that aren't in the input, from 1 to 20(because there should only be 20 agent).

My input is :
1 3 250.00
2 0 0
15 1 1000.00
3 4 300.00
12 2 500.00
1 2 300.00
3 4 115.00
21 3 400.00
-1 4 250.00
15 1 200.00
9 5 -150.00
18 2 140.00
13 2 550.00

the first numbers are the agent numbers so 1 , 2 ,15 are agent numbers and out output for agents who didnt participate are : 2 , 5 , 6 , 7, 8, 9, 10 , 11 , 14 , 16 , 17 ,19 20

this is the code ive wrote but its not working.

void not_part() {
ins.open(in_file);
int i=0;
int sum=0;
cout<<"AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN"<<endl;
cout<<fixed<<showpoint;

[code].....

View 1 Replies View Related

C# :: Emails And Phone Numbers - Output List Name Not Text?

Sep 11, 2014

Trying to output a .txt file of names emails and phone numbers, but this only outputs the list name: Email.PersonEntry.

private void button1_Click(object sender, EventArgs e) {
DialogResult result;
string fileName;
//Find and Open File

[Code] ....

View 6 Replies View Related

C++ :: File Input / Output - Getting Highest And Lowest Number From A List Of 7 Numbers

Apr 16, 2013

I am currently confused on how to get the highest and lowest number from a list of 7 numbers for a File Output. Lets say i have 165 19 654 816 654 987 324. How would i get the 987 for the highest and the 19 as the lowest? Those numbers are not fixed numbers, i need to be able to input any combination of numbers and still be able to get the highest and lowest numbers from the list of 7 numbers.

View 1 Replies View Related

C++ :: Looping - Input Numbers Until User Types 0 Then Output Product Of Non Zero Numbers

May 1, 2014

How to do the problem below using loop?

Input numbers until the user types a 0, then output the product of the non 0 numbers: e

E.g., if the user types 2 4 6 0, the program should output 48

View 3 Replies View Related

C++ :: Linked List Output Incorrect?

Oct 30, 2013

Were are to implement a method countValue() that counts the number of times an item occurs in a linked list. Remember to use the STL <list>

int countValue(list<int> front ,const int item);

Generate 20 random numbers in the range of 0 to 4, and insert each number in the linked list. Output the list by using a method which you would call writeLinkedList which you would add to the ListP.cpp.

In a loop, call the method countValue() , and display the number of occurrences of each value from 0 to 4 in the list.

Remember that all the above is to be included in the file ListP.ccp

The output should be:
2 3 4 0 1 0 2 4 2 3 3 4 3 3 3 0 0 2 0 2

0 : 5, 1 : 1, 2 : 5, 3 : 6, 4 : 3

but I am getting:

1 2 4 0 4 4 3 3 2 4 0 0 1 2 1 1 0 2 2 1

0 : 4, 1 : 5, 2 : 5, 3 : 2, 4 : 4,

Here is my code:

#include<iostream>
#include<list>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: How To Show At Least Two Numbers In The Output Instead Of One

Dec 12, 2014

I would like to know if there's a way to show at least two numbers in the output instead of just one. For example: instead of showing 4 it shows 04. Its for a console application.

View 3 Replies View Related

C++ :: Output Numbers As 2 Decimal

Feb 11, 2013

My program needs to be adjusted to send out the numbers as 2 decimal , but nothing work.

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int
number_ofstyle_American,
number_ofstyle_Modern,

[Code] .....

View 1 Replies View Related

C# :: Output Numbers In Different Order?

Mar 17, 2015

I am currently writing a program and am having some trouble figuring out how to get the order correct in the output.

Here is my code:

using System;
using System.Collections;
using System.Text;
namespace The_Last_Survivor {
class Program {
static void Main(string[] args) {

[code].....

The output I need to have is:

Actors Count Audition Order

1 1 1

2 1 1 2
2 2 2 1

3 1 1 2 3
3 2 2 1 3
3 3 3 1 2

4 1 1 2 3 4
4 2 2 4 3 1
4 3 3 2 4 1

[code].....

Right now the numbers are just printing in order 1-9 and not changing.

View 7 Replies View Related

C :: Output Calculation (random Numbers)

Mar 24, 2014

Why do i keep getting wrong results

Code:
#include "stdafx.h"#include <stdio.h>
#include <string.h>
nt main(void){
char name[40];
int numbers[50];

[Code] .....

View 4 Replies View Related

C++ :: Program That Reads In Ten Whole Numbers And Output Sum

Jan 23, 2014

Write a program that reads in ten whole numbers and that output the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the ten numbers just once each and the user can enter them in any order.

Your program should not ask the user to enter the positive numbers and the negative numbers separately. Assume the user will type integer numbers.

this is what i got but it wont run saying there is an error

#include<iostream>;
using namespace std;
int main() {
int count=0;
int num;
int positive=0;
int negative=0;

[Code] ....

View 5 Replies View Related

Visual C++ :: Output Of Random Numbers

Apr 6, 2015

I wrote an code for generating an aoutpu of random numbers, but it doesn't gives me back the numbers here is the code:

#include <iostream>
#include <time.h>
#include <cstdlib>
#include <stdio.h>
#include <iomanip>
#include <cmath>
using namespace std;
const int ANZ = 6;

[Code] .....

I cant find the mistake.

View 2 Replies View Related

C++ :: Debug Function For Application - Output Values List

Jul 11, 2012

I'm trying to write a debug functions for my application so I can see all the values I like to. My goal is it looks like this:

Code:
void Debug(std::message, ...)

So that I can call it like this:

Code:
Debug("Error: %i, %i", 34, 35);

How I can work with %i, or if there are better solutions. This is what I've so far (not much), just a basic idea:

Code:
void Debug( std::string message, ...) {
va_list list;
va_start(list, message);
??? va_arg(list, ?? );
va_end(list);
// here message should contain everything and be ready for output ?
cout << message << endl;
}

View 3 Replies View Related

C :: Not Getting Actual Output While Displaying Hex Numbers In Decimal Format

Apr 26, 2013

I need to display 0-15 hex numbers[0X00-0x0F] in decimal value...& I'm getting the output but it's not exactly what it should be,below is my code.. [This not the complete code,but main part where the changes are done]

Actual output i should get is for 1v it should generate 0001,for 2v it should generate 0010 and simultaneously till [15v-1111]... But what i'm getting is exactly different to this for eg for 7v,8v&9v the bits generated are 1101,1011,1011 respectively...

[URL] ....

Code:
sbit V1 = P2^0;
sbit V2 = P2^2;
sbit V3 = P2^4;
sbit V4 = P2^6;
#define DAC_table V1,V2,V3,V4

#include <stdio.h>
#include <string.h>
idata unsigned int ptr2tbl ;

[Code] .....

View 2 Replies View Related

C++ :: Simple Input / Output - Float Point Numbers

Apr 26, 2012

I have a simple input output problem using float point numbers and after the first input the program skips the other cin functions is there something that I did wrong? It compiles fine also.

Code:
#include <iostream>
#include <float.h>
using namespace std;
int main() {
int x;
int y;
int z;

[Code] .....

View 5 Replies View Related

C/C++ :: Keeping List Of User Guesses And Output Message If Guess Is Duplicate

Apr 19, 2015

The label "You already picked that" doesn't always appear. Sometimes it does, but only if a duplicate has been entered at least 3 times. I haven't been able to correct this. I am new to programming and array-based lists.

//Objective: randomly generate an integer between 1 and 100, input user guess as to what number it is, and output "correct!" if user guess is the random number, or output "Too high" if the user guess is too high, or output "too low" if the user guess is too low, "you already entered __" if a duplicate is entered and allow the user to keep guessing until they guess the correct number

//libraries
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <iostream>
using namespace std;
struct Guess {

[Code] ....

View 9 Replies View Related

C++ :: Output All Prime Numbers Between Values Of StartNum And EndNum Variables

Apr 7, 2013

The code below is suppose to output all the prime numbers between the values of startNum and endNum variables. but its not working correctly instead it display all the numbers between startnum and endNumber including non-prime numbers.

void PrimeFinder::run(){
bool isPrime = false;
for(int i = startNum; i <= endNum; i++) {
for(int j = 2; j < i; j++){
if((i % j) == 0)

[Code] ....

View 6 Replies View Related

C++ :: Read Two Positive Integers That Are 20 Or Fewer Digits In Length And Output Sum Of Two Numbers

Apr 30, 2013

so basically my project goes like this:

Write a C++ program that reads in two positive integers that are 20 or fewer digits in length and outputs the sum of the two numbers.

Your program will read the digits as values of type char so that the number 1234 is read as four characters '1', '2', '3' and '4'. After they are read into the program, the characters are changed to values of type int. The digits will be read into a partially filled array and you might find it useful to reverse the order of the elements in the array after array is filled with data from the keyboard.

Your program will perform the addition by implementing the usual pencil and paper addition algorithm. The result of the addition is stored in an array of size 20 and the result is written to screen. if the result of the addition is an integer with more than maximum number of digits(that is more than 20 digits) then your program should issue a message saying that it has encountered "integer overflow".

You should be able to change the maximum length of the integers by changing only one globally defined constant. Include the loop that allows the user to continue to do more additions until the user says the program should end. What I have so far is

#include <iostream>
#include <cstdlib>
using namespace std;
void reverseArr(int a[], int liu);
void addLargeInt(int a1[], int liu1, int a2[], int liu2, int sum[], int& liu_sum);
int main() {
cin.get(next);

[Code]...

View 2 Replies View Related

C++ :: Effect On Output Of Program Of Different Numbers Input To Int Data Type Named

Mar 2, 2014

// this program gives random number output
#include <iostream>
#include <cstdlib>// contains function protype for rand
#include <iomanip>// for setw
using namespace std;

[code]....

what is the effect on output of program of different numbers input to the int data type named seed*/

View 1 Replies View Related

C++ :: Linked List Won't Take Big Numbers

Jan 2, 2013

My program is almost done all that is left is entering big numbers, the program can add and subtract small numbers but not big numbers because it puts them all in one node, I need the program to store each number in a node.

#include<iostream>
#include<string>
using namespace std;
class Node {
public:
int value;
Node * next;

[Code] .....

View 11 Replies View Related

C :: How To Use Loops To Find Numbers From A List

Apr 27, 2013

i have to make a program where a user inputs one number and i have to find the number of a certain amount of number in the program.
for example:

user input: 2349354787839
output: There are two sevens

i know it has the use of loops but i am having trouble finding a way to scan each individual digit in the input to find if it is a seven or not.

View 8 Replies View Related

C++ :: 250000 Numbers - List Of Subsets

Mar 7, 2014

Given up to 250000 numbers i have to produce a list of subsets(first of one element, then of two etc). Is there an easy way using a bitset<250000> ?

View 1 Replies View Related

C++ :: Using List To Implement Huge Numbers?

Nov 22, 2013

Im trying to implement a way to use really big numbers to be able to add, substract and multiply them with the class I made. for example:

huge a = "45646464646455464654656"
huge b = "456464564646544646"
huge c = a+b;

[Code]....

View 13 Replies View Related

C++ :: Storing A List Of Numbers In Integer?

Dec 6, 2014

I am writing trying to store a list of numbers into an integer as bits. So far I have this:

n=n & 0x0f
integer = integer<<2
integer = integer | n;
convert(integer));

I want it to store the integers as bits so that I am move them over and store them farther down the row as more numbers are added, but instead each new number is being added to the previous and I'm just getting a larger integer. Is this even a feasible way to store integers within an integer?

View 1 Replies View Related

C++ :: Take Numbers And Add One By One As Integers In Linked List

Aug 21, 2013

Let's say that in a txt file named hot.txt, I have this:

12,23,32

And with ifstream I want to take those number, adding one by one as integers in a linked list.

ifstream myList;
char* p= new char;
cin>>p;
myList.open(p);

if(myList.is_open()) {
char* x =new char;

[Code] ....

I know this part is quite wrong :

myList.get(x,256,','); // dafaq
int num=atoi(x);
list->addOrdered(num);

What I wanted to do is to stop before each comma and take that character and store it in the linked list and continue until the end of the file, but I couldnt.

View 6 Replies View Related

C++ :: Constructing A List To Typing Numbers And Count Them

Dec 17, 2013

i have read a lot of about lists but i dont understand this. I know its something like dogs on leash where we have

dog1->dog2->dog3->....
and
Code:
struct DOG
{char* (name of a dog of first leash)
DOG* (next dog ) } I have written something like this but this doesnt work as i wanted Code: #include <iostream>
using namespace std;
struct line {

[Code]....

I wanted to make program where i can type XX numbers , then cout those numbers without changing the order, and my next exercise is to change order in this programme from end to start.

View 7 Replies View Related







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