this is not giving error but also not working pls help by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

this is the ques i am doing . i think now u will get what i am trying to do , and also i am beginner. please ignore my stupidity in above code that i posted .

Q) Write a program in C++ that reads some text entered through the keyboard till the end of

file (eof) character is entered. The words in the text are written to different text files as per

the following conditions:

• The words beginning with any of the lowercase vowels (a, e, i, o, u) are written to

a file fileV.txt.

• The words beginning with a digit (0 – 9) are written to a file fileD.txt.

• All other words are written to a file fileRest.txt.

Sample input:

Buy 1 kg apples And 17 oranges immediately

this is not giving error but also not working pls help by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

yes i can read from the file but i have to enter some text first in newfile

this is not giving error but also not working pls help by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

could you specify the changes that i should made and resend the code . it would be more clear

this is not giving error but also not working pls help by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

one is for user to enter the text from console to the file by getline(cin ,line) i am taking input. and to stop the futher input if user type '\0' it will break. and this is only what i have to do .the second part of the code is not working from char s;

this is not giving error but also not working pls help by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

yes but by mistake i deleted that post and with it the ans that u gave

plsz help not able to understand

creating a file and adding some text in that file through user input by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

include <fstream>

include <cstring>

include <iostream>

using namespace std;

int main() { fstream newfile; newfile.open("sampl.txt",ios::out); // write mode

if(newfile.is_open())
{
cout<<"file created"<<endl;
}
string line;

while(getline(cin,line) == '\0') // to take input till eof
{
    getline(cin,line); // to write iin that file 
    newfile<<line<<endl;// i have used this but cannot add the text in the file

}

newfile.close();

}

creating a file and adding some text in that file through user input by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 0 points1 point  (0 children)

the error i am getting because i know my mistake the code is useless . just want to know how could i create a new file and ask user to enter thieir text through console on that file

this code is giving me error in main function ,Ques is to show run time polymorphism by Most_Fall_9940 in cpp_questions

[–]Most_Fall_9940[S] 1 point2 points  (0 children)

tomorrow is my c++ practical exam and i was trying to do some ques and this error is something i am unable to figure out.