C++ queries????

Status
Not open for further replies.

latino_ansari

Legendary Darknight
Guys i have got a program to write... can u guys help me with it???? please i am not good with c++ and i have to submit it... Please write me the program...

Q. Write a C++ program that copies a test file. In the process, reverse the case of all letters.

Please guys... Help
 
I dont think anybody here will write the whole program for you. Thats your job and you must do it urself. If you'll ask for guidance, only then can somebody help you. Try it and ask for any hints that you need. Its just a sincere advice, no offence meant.
 

Mayur Somani

Right off the assembly line
Read the file one char at a time and just reverse the case of the current char. Simple File IO problem.
 

j_h

Banned
Guys i have got a program to write... can u guys help me with it???? please i am not good with c++ and i have to submit it... Please write me the program...

Q. Write a C++ program that copies a test file. In the process, reverse the case of all letters.

Please guys... Help

agar tereko c++ nahi aata hai toh buy a book and learn. tera college ka major change kar and dont take c++ classes. dushron se homework karneko kehna paap hai :)

Heres ur hint for the homework :

just a hit use r own logic :D
open the file using file.open
and get the string.

then for lowercase
string x = "mera HOMEWORK dushre log KArTE hai"; //MIX of upper and lower
for(int i = 0; i < 1000; i++) //check for /n in ur case
{
if(x + 32 < 122) //122 is the value for "z".
{
x += 32; //32 is the difference between an uppercase and its lower counterpart
}
}
For conversion to uppercase, change the if statement to

if(x - 32 > 65) // 65 is the value for "A".

and x += 32 should be changed to x -= 32
 

red_devil

Back!
agree with most of what has been said above.

only disagree with one line of this pseudo code :

Code:
string x = "[B]mera HOMEWORK dushre log KArTE hai[/B]"; //MIX of upper and lower
for(int i = 0; i < 1000; i++) //check for /n in ur case
{
if(x[i] + 32 < 122) //122 is the value for "z".
{
x[i] += 32; //32 is the difference between an uppercase and its lower counterpart
}
}


my little knowledge of programming tells me to change the line in bold to

"Main Apna homeWork dusron se KarWanA cHahtHa HooN"

hopefully the logic is correct :D
 
Status
Not open for further replies.
Top Bottom