Hi, I am trying to learn OOP with c++ with the help of Turbo C++ version 3.0 and "C++ Primer Plus" by stephen prata. according to the book, the NEW convention for including the iostream header file in c++ is in the following way: #include<iostream> but it causes an error saying : unable to open include file "IOSTREAM" however the following code works: #include<iostream.h> but it is supposed to be the OLD convention Moreover , according to the book, it is necessary to use the following: using namespace std so that we can use cout and cin directly without having …

Member Avatar
Member Avatar
+0 forum 6

Hi Guys. First of all is it possible to detect a file copying/moving within the system, I'm sure this is done in lower languages like C++ but I've tried searching but I don't seem to find not even en example, maybe it because I don't know how it correctly called. The copying will be occuring outside my application, I want something like hooking if thats the correct term. Also the most importent part is how can I detect file drag and drop. Let me clear this out I don't mean to allow drag and drop within VB.NET app(Form) but want …

Member Avatar
Member Avatar
+0 forum 5

I have to create a program that asks a person to enter a 2 digit number (10-99) and convert it into words. I've been working on this for days and I still don't see what I'm doing wrong! PLEASE HELP ME!!! EXAMPLE: 27 twenty-seven [CODE]#include <iostream> using namespace std; int main() { int num; int ones_digit = num%10; int tens_digit = num/10; cout << "Enter a two-digit number:\n"; cin >> num; if (num>=20) && (num<100) { switch (tens_digit) { case 2: cout << " twenty- "; break; case 3: cout << " thirty- "; break; case 4: cout << " …

Member Avatar
Member Avatar
+0 forum 8

How would I fix something like this: It is without the is a vowel or is not a vowel, still doesn't work but how do I fix it? This is what it Today Is Thr Jan, 2015 Enter a sentence: #include <iostream> #include <iomanip> #include <string> using namespace std; int main() { int Uc = 0, Dc = 0, Vc=0; int i=0; char c = getchar(); string vowels("aeiouAEIOU"); cout << "Enter a sentence: "; cin.get(c); while (c != '\n') { if (c >= 'A' && c <= 'Z') { Uc++; i++; } else if(c >= '0' && c <= '9') …

Member Avatar
Member Avatar
+0 forum 2

Hello, I have a bug in my program somewhere and I cannot understand why. The program merely prints data from a binary file. Here is the code: #include <iostream> #include <fstream> #include <vector> #include <cstdint> using namespace std; int main(int argc, char *argv[]) { if (argc!=2) { cout<<"Invalid argument count, please provide a file name."<<endl; return 0; } fstream file(argv[1],ios_base::binary|ios_base::in); vector<int32_t> data; int32_t tmp; char buf; while (!file.eof()) {//complicated i/o to ignore endianness file.read(&buf,1); tmp=buf<<24; file.read(&buf,1); tmp|=buf<<16; file.read(&buf,1); tmp|=buf<<8; file.read(&buf,1); tmp|=buf; data.push_back(tmp); } for (size_t i=0; i<data.size(); ++i) cout<<hex<<data[i]<<endl; return 0; } Most of the time it works fine. However, …

Member Avatar
Member Avatar
+0 forum 8

Hello, Looking at the standard streams provided by the stl libraries, it seems as though it is impossible to have 1 stream to use for both standard console IO and file/string IO. However, before I give up I would like to ask, is this possible: generic_stream stream; stream=cin; //now I can use stream as cin stream>>value; stream=fstream("myFile.txt"); //now stream acts as a stream to myFile... value>>stream; stream=sstream("123 test"); From what it looks like, since fstreams use input and output they derive iostream, which in turn derives istream, which in turn derives ios. However cout uses ostream instead of istream and …

Member Avatar
Member Avatar
+1 forum 7

I'm using "Digital Mars" to compile the following program: [CODE] #include <iostream> using namespace std; int main() { cout <<"My name is Abder-Rahman"; return 0; } [/CODE] And, this is what I get: [CODE] C:\Users\Software Engineer\Desktop\C++\dm852c\dm\bin>dmc print1 Fatal error: unable to open input file 'iostream' --- errorlevel 1 [/CODE] Any ideas on that? Thanks.

Member Avatar
Member Avatar
+0 forum 3

Nice to meet you, i am a newbie i would like to ask a question that bothers me out : 1).How to add the decimal representation of N! (5 <= N <= 1,000,000) is simply the multiplicity of the prime factor 5 in N! to my script? 2). I wanted to ask how the output of case#3:118 became case#3:27,whether the problem is string or an Integer? and how to solve it? Could you help me out. thanks here's my code code: Package test; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class test { String trailing; String y; /** * @param …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to create a program where I can print output to my console application and entering test without being override. Is there anyway to accomplish this? Here is my simple code showing my issue: ` #include <iostream> #include <thread> #include <Windows.h> void myThread() { while (1) { std::cout << "hello world" << std::endl; Sleep(1000); } } int main() { std::thread t1(myThread); while (1) { std::cin.get(); } return 0; } `

Member Avatar
+0 forum 0

when dealing with files, is it possible to write or read any file extensions e.g. .docx, .pdf e.t.c.?

Member Avatar
Member Avatar
+0 forum 2

I am trying to add a comma to the end of each line ('\n') of a text file til the end of the file is reached. I am opening the file in append mode but am unsure as to how to go about identifying when the end of line is reached and how to add the comma (perhaps replace the newline char with the comma). Any suggestions?

Member Avatar
Member Avatar
+0 forum 3

I'm trying to make a program for my computer science class and it requires that I run output to the console as well as to a file. I'm looking for a way to intialize a string at the beginning of the program and pass the variable by reference to my functions. The functions will then append strings to the intialized variable. I need to be able to also set precision and justification for floating point variables that will be appended to the string. I am working with stringstream right now but every time I return the output string that I …

Member Avatar
Member Avatar
+0 forum 2

So i just started my project on a cpu sim , but right of the bat i ran into a problem #include <cstdlib> #include <fstream> #include <iostream> using namespace std; /* * */ int main(int argc, char** argv) { return 0; } void cpu() { } void memory() { int memArray[1000]; ifstream infile; infile.open("program.txt"); } my ifstream is having trouble, i think it has to do with the headers but i dont know how to fix this , am kind of bearly picking up c++ again. So any help is appriciated, ok between using netbeans ide, and i also already …

Member Avatar
Member Avatar
+0 forum 2

Hello, I have the following code: `#include <iostream.h> void main() { double test=3.46578953218549; cout.setf(ios::dec); cout<<test; }` I understand that iostream.h is outdated and Microsoft Visual Studio has iostream. However, When I remove the ".h" the setf, ios, etc, line 6 has multiple errors. So, my question is: How do I set the number of decimal places without having "setprecision(51)" in every cout line, as such: `#include <iostream.h> void main() { double test=3.46578953218549; cout<<std::setprecision(51)<<test; }` Or, where can I download iostream.h? Joe

Member Avatar
Member Avatar
+0 forum 6

Hi all, I have a simple program: #include<iostream> using namespace std; 6 int main() { char x; do { scanf("%c", x); } while (x != 'y'); return 0; } and for some reason when i gcc test.c i get "test.c:1:20: fatal error: iostream: No such fiel or directory compilation terminated." I had a look around but couldn't find oput what the problem is. This is the first time I have used gcc to compile since i installed so could the iostream fiel be missing :S? Please help. Thanks

Member Avatar
Member Avatar
+0 forum 10

Ok how would I make a program take one file (thats not a text file) and save with a different name like there is a file with asdf.7z and I want the program to save a copy of it as qwer.7z how? And is there any way to do something like this: [CODE] cin>>imput; system(""<<imput);[/CODE] Thats the best I can make an example so those are me questions.

Member Avatar
Member Avatar
+0 forum 2

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 the user enters an integer when i wanted a string or if the user enters nothing and causes weird results

Member Avatar
Member Avatar
+0 forum 13

I am using the CodeLite IDE. I compiled the following program using CodeLite (It is a C++ program): [CODE]#include <iostream.h> int main() { cout << "Hello World\n"; return (0); }[/CODE] It returns this message: g++ -c "/home/keagan/.coding-work/Hello/printamessage.cc" -g -o ./Debug/printamessage.o "-I." "-I." /home/keagan/.coding-work/Hello/printamessage.cc:1:23: error: iostream.h: No such file or directory /home/keagan/.coding-work/Hello/printamessage.cc: In function ‘int main()’: /home/keagan/.coding-work/Hello/printamessage.cc:4: error: ‘cout’ was not declared in this scope make[1]: *** [Debug/printamessage.o] Error 1 make: *** [All] Error 2 Anybody have any idea how to fix this? It seems to be a library issue... --thanks, techningeer

Member Avatar
Member Avatar
+0 forum 2

The End.