24 Topics

Member Avatar for
Member Avatar for nathan.pavlovsky

Hello Programmers! I am working on a C++ phone number class. The class has overloaded stream manipulators, cin and cout for output. It has three private members: areaCode, exchange, and line, strings that represent the numbers that are used in a telephone call. It is supposed to default to (000) …

Member Avatar for 2teez
0
573
Member Avatar for TommyTee

Hi guys, I have a class called Account with variables called Balance and Status. The Member Name is given by the User through cin and represents an the Account Number. How can I diynamically create an object through cin and give their variables a value through cin? I have been …

Member Avatar for David W
0
2K
Member Avatar for nathan.pavlovsky

Hellp programmers! I am working on a program that uses two objects of a custom class template List [which is a linked list, with each item pointing to the next] and concatenates them. Initially, I need to input numbers into my main function, so I have two sets of while …

Member Avatar for nathan.pavlovsky
0
4K
Member Avatar for shadowplayer28

when converting iget erros especially in the cin parts because they are automatically passed by something #include<iostream> #include<conio.h> #include<math.h> using namespace std; int p=1; class Bank { public: char name[50],address[90],type; double ein_betrag, aus_betrag; double balance; int costumernr, accountnr, birth, tel; public: void newcostumer(); void newaccount(); void costumerdel(); void accountdel(); void …

Member Avatar for Schol-R-LEA
0
300
Member Avatar for mystycs

I am getting an error on this code. Is it to do with whats in the while loop? How do i get it working? Basically i want to be able to take in letter or number variables, and each would output something, and if they type exit it breaks out …

Member Avatar for David W
0
500
Member Avatar for David W

In the last few days, I have noticed a very old thread ... resurrected ... about a non-standard C getline function. To all who may like a C readLine function ... a C function that reads in a dynamic C string of any length ... a function with a similar …

0
209
Member Avatar for learner_new

#include<iostream> using namespace std; int main() { int len1; cout<<"please enter the length of arrayn 1"; cin>>len1; cout<<"creating array now"; int *arr1= new int[len1]; cout<<"please enter the elements now"; for(int i=0;i<len1;i++) { cin>>arr1[i]; cout<<endl; } return 0; cout<<arr1; delete [] arr1; } In the above code, the program stops execution …

Member Avatar for shaykhhamza
0
293
Member Avatar for breezett93

Hi everyone, I am writing a program that converts numbers to words and vice-versa, like typing on a older cellphone. The user enters as many messages as he wants in numbers and/or text. The first character of the messages indicates what the remaining string is: numbers or letters. I can't …

Member Avatar for tinstaafl
0
221
Member Avatar for nullifyQQ

User is supposed to type an input, and if it's not an integer, the user needs to type another. This repeats 3 times for 3 inputs which go inside an array. The integer checking works, but the problem is that when i display the 3 integers, they are all the …

Member Avatar for deceptikon
0
301
Member Avatar for andigirlsc

I am having trouble getting MS Visual C++ to recognize my input for the 2nd getline I have listed. It already recognizes getline(cin, firstName) and allows for input, but won't recognize the second instance of getline. When the program gets to that line of output, it bunches the next two …

Member Avatar for deceptikon
0
374
Member Avatar for existinglady

excuse me but can someone teach me how to get a string with space example : this author i need to get the codes on how to get that thank you

Member Avatar for Lucaci Andrew
0
404
Member Avatar for Lucaci Andrew

I have this function: void read(){ int id; string desc; string title, type; cout<<"Movie's id: "; cin>>id; cout<<"Movie's title: "; cin>>title; cout<<"Movie's description: "; getline(cin, desc, '\n'); cout<<"Movie's type: "; cin>>type; cout<<"You have typed in: " <<id <<" " <<title <<" " <<desc <<" " <<type <<".\n"; } and my …

Member Avatar for Lucaci Andrew
0
272
Member Avatar for isaacjun16

Hi, I have a problem with a the imput of some data on a program Im making (FYI new in c++, homework). So basicly the progrma I have is to imput diferent type of data, this is what im doing. (Im using codeblock 8.02 in Ubuntu 10.04 ) #include <iostream> …

Member Avatar for isaacjun16
0
264
Member Avatar for thecoolman5

hi, I have this code: [CODE]#include<iostream> #include<cstdio> #include<sstream> using namespace std; int main (char argc) {        float n1;        char operators;        string n2;        float n2_act;        float ans;        cin >> n1;        …

Member Avatar for thecoolman5
0
263
Member Avatar for blackrainbowhun

Hello everybody! I'm participating in a competition, and I just finished my program. It doesn't really matter what it does, and how. I have encountered a bug I think. I'd appreciate every kind of help, because with the problem, my solution fails for the test file. I have to read …

Member Avatar for Schol-R-LEA
0
167
Member Avatar for jcAmats

hi! can someone help debug my codes? getline() works properly in my main() but if i'm putting it to another function, it ignores the first getline() w/o entering any words and goes to the 2nd getline. my program works like this: i have a menu() that lets the user to …

Member Avatar for jcAmats
0
363
Member Avatar for imsinu

if i hav to input time of clock as formatted style(HH:MM:SEC) using cin how can i write its code???? a question from @robert lafore(sams publication) . hope to get a best answer soon :)

Member Avatar for imsinu
0
178
Member Avatar for kjcjk

When I run my program it ignores the cin and goes into an infinite loop. It acts as though the cin.ignore() isn't working. [CODE] int getInput(int tries){ int numGuess = 0; cin >> numGuess; cin.ignore(); validate(numGuess, tries); return 0; } int validate (int input, int tries){ if (input <1 || …

Member Avatar for WaltP
0
222
Member Avatar for fragtech

My program generates a list of random or pseudo random numbers between a certain range specified by the user through the console. My problem is when the user, or in this case myself, tries to generate a random number list specified by entering true(1) in the console the output is …

Member Avatar for WaltP
0
171
Member Avatar for helpplease234

Need a little help, I'm trying to run a program that asks the user to enter an integer between 1-50. If given a number between 1 and 50 then echo number then add all integer between 1 and integer entered if user enter an integer not between 1 and 50 …

Member Avatar for Fbody
0
294
Member Avatar for jackmaverick1

Hi, I'm very new to Java (started today, though I have 1.5 years in c++) and I've now read a little bit about Java, the thing that I can't find is how to take user input from the keyboard through a console window... How can you go about do that? …

Member Avatar for sourabh17
0
192
Member Avatar for RyanMcMillan

How Would i be able to check for valid input on cin or getline heres what i have [CODE] #include <iostream> #include <string.h> using namespace std; int main() { string word; getline(cin, word); cout << word; system("PAUSE"); return EXIT_SUCCESS; } [/CODE] what i mean by valid input is either if …

Member Avatar for Fbody
0
533
Member Avatar for Razzo1

Well I am coding a small intermediate program to help me with learning c++ , and i am wondering how to check for blank input to cin >> string heres what i have [CODE]string name; cout << "Enter You're Name: "; getline(cin, name); [/CODE] and if i just hit enter …

Member Avatar for mike_2000_17
0
2K
Member Avatar for JordanHam

I am just having trouble with the beginning stages here. I am just very confused on different syntax terms. I have a book here "Microsoft Visual C++.net" with all the installation and whatnot with it. It doesnt use the normal cin and cout but used Console::WriteLine and what not. Is …

Member Avatar for JordanHam
0
128

The End.