49,757 Topics

Member Avatar for
Member Avatar for anamoblu56

I am a beginner and I am using Visual Studio 2008. My code is good and output is: Day 1, "Enter Temperature 1: Day 1, "Enter Temperature 2: and so on until Day 7. What I want it to read is: Day 1, "Enter High Temerature 1: (for column [0]) …

Member Avatar for anamoblu56
0
82
Member Avatar for pinkboom

Hey guys, I wrote a 'bigger' program that uses a basic algorithm to crypts a text I input from keyboard, or from another text file. I have divided the program in the 'working' part and the 'non-working' part. The keyboard input is great, it works perfectly. But when I try …

Member Avatar for pinkboom
0
149
Member Avatar for anamoblu56

Declare a seven-row, two-column int array named temperatures. The program should prompt the user to enter the highest and lowest temperatures for seven days. Store the highest temp in the first column and the lowest in the second column. The program should display the average high and average low for …

Member Avatar for MandrewP
0
2K
Member Avatar for topdos

hi i am new here and i registered because i couldn't find the answer in google search my problem is that i could not find max and min of two arrays and the average too [CODE]#include<iostream> using namespace std; int array1[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; …

Member Avatar for topdos
0
449
Member Avatar for Srinivas0

can some one please explain what is static variable, i tried reading some books, tried googling but i am not able to understand what are its uses. [QUOTE]a static variable retain their value even after the function to which it belongs is executed.[/QUOTE] i am not understanding what is meant …

Member Avatar for mrnutty
0
256
Member Avatar for anamoblu56

Have patience as I am a beginner at this.I have completeed my 2d Array and have displayed its contents successfully. At the end of my program I want to total column 1 and 2 ([0],[1]) and eventually average it, but my code is not giving me the correct math(see input …

Member Avatar for anamoblu56
0
98
Member Avatar for ahoysailor

Ok, so basically I have a text file that contains the following: Resource3 "Actuator" Resource10 "Insert Exhaust Valve" Resource1 "6, 10, 18, 1" Resource21 "Emergency Stop" Resource2 "Cool Down in Progress" etc. etc. I want to read the file line by line and store it in a vector (this is …

Member Avatar for mrnutty
0
174
Member Avatar for northrox

i still cant get an out put.. plus cin.get() doent work here.. why? [CODE]// to find factorial of a number #include<iostream.h> #include<conio.h> int main() { int i,m; cout<< "enter a number"; cin>> i; for ( int p=i;p>=0;p--) { p=p*(p-1); p=m; } cout << m; getch(); return(0); } [/CODE]

Member Avatar for Schol-R-LEA
0
96
Member Avatar for uzidon

All right, the solution for this question might be awkwardly simple, but I'm totally lost and confused on this. I have created a Windows Form Application in Visual C++ 2010 Ultimate and included some resource files (BMP Images) in Form1.resX. For example, one of them is picture1.bmp. I have a …

Member Avatar for uzidon
0
1K
Member Avatar for northrox

[CODE=cpp]#include <iostream.h> #include <conio.h> int main() { int number[5]; cout<< " enter the number \n"; for (int i=0;i<=5;i++) { while (i!=$) { cin >> number[i]; } } for (int i;i<='null';i++) { cout<< "number="<<number[i]; } getch(); return (0); }[/CODE] i have used a special character which tells the user to press$ …

Member Avatar for Schol-R-LEA
0
121
Member Avatar for Muhammad Anas

I have written the following for loop to demonstrate ceil() function of <cmath>. [CODE]for (double ceilDemo = 2.0; ceilDemo <= 3.0; ceilDemo += 0.1) cout << setw(10) << ceilDemo << setw(20) << ceil( ceilDemo ) << endl;[/CODE] The output is as expected except for the last iteration. I mean in …

Member Avatar for Muhammad Anas
0
121
Member Avatar for stereomatching

I would like to make pugixml print the node_pi as [code] <?xml version="1.0" encoding="utf-8"?> [/code] How could I manipulate node_pi through pugixml? Thanks

0
65
Member Avatar for Arkinder

I recently had an assignment that asked us to restrict the amount of characters a user can enter for his or her name. My professor said this is useful in the event that your program is being "attacked." The simplest solution was to use C strings: [CODE]#include <iostream> const int …

Member Avatar for Arkinder
0
6K
Member Avatar for MadeleinePV

Hi all, I've got a class which I would like to hold a stream used for logging. The stream should be able to be set (and possibly reset) after the construction of the object. It should be possible to set the stream as std::cout, or as a file stream to …

Member Avatar for mrnutty
0
956
Member Avatar for rjstamey

I was wondering if there is a way to make it so that someone can only input a specific data type. My program ask for input of specific numbers for a menu. If I enter a character, the program crashes. Is there a way to make it so that it …

Member Avatar for WaltP
0
105
Member Avatar for Jameske

So I have written some code which reads a file line by line, breaking each line into characters and storing into a multidimensional array. However the program freezes and crashes at lines 31-34. When debugging the code runs successfully through the for loop once, then fails at 32 the second …

Member Avatar for Jameske
0
212
Member Avatar for wmurrow

I have to count the number of records being read in and print them to the screen. A record consists of: website name (temp.url), website revenue (temp.rev) and website hits (temp.hits). These are all read in and returned as temp. For the life of me though, I can't figure out …

Member Avatar for wmurrow
0
107
Member Avatar for NoUserNameHere

Not getting any compile error, but I'm getting an output that looks like: -858993460 5 4 3 2 Instead of 5 4 3 2 1. What am I doing wrong? [CODE]#include <iostream> #include <stack> using namespace std; template <typename T> void reverse(stack<T> &sk) { stack<int> tempStack; while(!sk.empty()) { tempStack.push(sk.top()); sk.pop(); …

Member Avatar for tharumax
0
96
Member Avatar for flendernik

Hi! Can anyone please tell me where my mistake in this is? The information from the list has to be transferred to the tree. But only the first element is copied. [CODE]#include<iostream> #include<string> using namespace std; struct Person{ char first[30], last[30]; }; struct aList { char adr[30]; Person name[30]; int …

Member Avatar for flendernik
0
133
Member Avatar for Brian_L

In my program, I used a vector to store the file. The file contains the data (see below). Do I need to create two vectors to store the data below as integers and strings? Or is there a shorter way to do this, and just allow the user to enter …

Member Avatar for Brian_L
0
97
Member Avatar for Kuroshi

I get this compiler error: `Monster' was not declared in this scope, in this code: [CODE]#ifndef ROOM_H #define ROOM_H #include <stdio.h> #include <stdlib.h> #include <time.h> #include <vector> #include <iostream> #include "Monster.h" using namespace std; const int ROWS = 20; const int COLS = 20; class Room { private: vector<int> indexes; …

Member Avatar for VernonDozier
0
123
Member Avatar for Valociraptor

I am attempting to create a sorted array for a class assignment but I am receiving a weird access violation error in my debug code. I have double checked all my values and nothing is accessing anything out of range. My code is below. Thanks. [code=c++] #include <iostream> using namespace …

Member Avatar for Schol-R-LEA
0
219
Member Avatar for Kuroshi

I am experiencing problems with this function: void move (Room&); For some reason the compiler is saying that this is a variable or field, here is the implementation: [CODE]void Monster::move (Room& room) { vector<int> iCoordinates; vector<int> jCoordinates; for (int i = x - 1 ; i <= x + 1 …

Member Avatar for Kuroshi
0
326
Member Avatar for EXpoZuR

My program needs to take the first 5 numbers from a file, sort them and print them out. Then take the next 5 numbers and sort just those 5 numbers and print them out. However, when I try to sort them independently it is sorting them all together as if …

Member Avatar for EXpoZuR
0
100
Member Avatar for dancks

I haven't coded something this complex in C++ before and I haven't had time to really review. I'm making a game (well, foundations for a game anyway), with an external game library, Allegro. But I think the problems I'm having is more fundamental to C++ in general. Included is a …

Member Avatar for dancks
0
298
Member Avatar for Madbabe

Hi, I need help writing a program for the powerball game. so this is what i have so far. I am having difficulties in comparing the numbers generated and the numbers entered by the user. This is what i have so far. [CODE] #include <iostream> #include <cstdlib> #include <ctime> using …

Member Avatar for Schol-R-LEA
0
75
Member Avatar for Panathinaikos22

Hello, i want to ask, messing words in array is a good way to encrypt data? or can someone very easy to brake it here is an example [CODE] #include "stdafx.h" #include <fstream> using namespace std; // Decleration for functions void EncryptFile(char c[], int key1, int key2); void DecryptFile(string filename, …

Member Avatar for VernonDozier
0
386
Member Avatar for EXpoZuR

I have to read numbers from a .txt file and sort them. I am trying to use selection sort. The .txt file looks like this: 3 33.3 92.5 4.5 6.29 5.3 94.3 -7.455 4.66 -9.33 -211.2 .03 .12 0.34 4.83 2.494 I am now working on the first 5 numbers …

Member Avatar for EXpoZuR
0
215
Member Avatar for Ahmed2

Hello every body I'm trying to iterate through a list for a certian number of times using a for loop. below is the current code I've written, but this will iterate through the list until it ends. [CODE]list<FileInfo*>::iterator p = currentlist.begin(); while(p != currentlist.end()) { cout << (*p)->remainingtime << " …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for marcux

Hi all! I am quite new to C++ and just been hacking with stdlib. When I want to start hacking other things outside stdlib, like network aso. I get confused and can not find what I am looking for. I use GNU/Linux and want to use "native" libs for that. …

Member Avatar for Schol-R-LEA
0
118

The End.