Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

This answer was rated:

I am asking for your assistance with lab 7 for my Intermediate…

I am asking for your...
I am asking for your assistance with lab 7 for my Intermediate C++ Programming Course. I don't know if you still have the syllabus. If not, I can upload it.
Show More
Show Less
Ask Your Own Programming Question
Answered in 6 hours by:
6/25/2010
Seth
Seth, Software Engineer
Category: Programming
Satisfied Customers: 1
Experience: 5 years of field experience using multiple languages and technologies
Verified
Would you mind posting the syllabus, or a link to the lab description?

Thanks,
Seth
Ask Your Own Programming Question
I found the syllabus on a previous post - I will begin work on the solution to lab 7 for you.
Ask Your Own Programming Question
Customer reply replied 8 years ago
Thanks
I believe the code below should meet the specs outlined for p7, other than the header comments and such that the instructor requires. Please let me know if you would like any additional documentation or comments within the code. I used g++ to compile the code: i.e. "g++ main.cpp"

Let me know what you think!

Cheers,
Seth

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void encrypt(string &str)
{
for(int i = 0; i < str.length(); i++)
str = str ^ 172; // bitwise XOR operation with an arbitrary number
}

void decrypt(string &str)
{
encrypt(str); // decrypt works the same as encrypt
}

int main(void)
{
cout << "Please enter a file name where you wish to store your encrypted messages: ";
char filename[128], filenameWithDirectory[130], inputLine[1024];
cin.getline(filename,128);
strcpy(filenameWithDirectory, "./");
strcat(filenameWithDirectory, filename);
ofstream ofs(filenameWithDirectory, ios_base::out);
if(!ofs.is_open())
{
cout << "An error was encountered while attempting to open file: " << filename << ". Shutting down." << endl;
exit(0);
}

bool continueEncrypting = true;
while(continueEncrypting)
{
cout << endl << "Please enter a line to be encrypted, followed by ENTER." << endl;
cin.getline(inputLine, 1024);
if(strlen(inputLine) > 0)
{
string inputStr(inputLine);
encrypt(inputStr);
ofs << inputStr << endl;
}

do
{
cout << "Enter another line? (y/n): ";
cin.getline(inputLine, 1024);
if(strcmp("n", inputLine) == 0)
continueEncrypting = false;
}while(continueEncrypting && strcmp("y", inputLine) != 0);
}

ofs.close();

cout << "Proceeding to re-open file, and display encrypted and decrypted contents." << endl;
ifstream ifs(filenameWithDirectory);
if(!ifs.is_open())
{
cout << "An error was encountered while attempting to open file: " << filename << ". Shutting down." << endl;
exit(0);
}

ifs.getline(inputLine, 1024, '\n');
while(ifs.good())
{
cout << "Encrypted: " << inputLine << endl;
string str(inputLine);
decrypt(str);
cout << "Unencrypted: " << str << endl << endl;
ifs.getline(inputLine, 1024, '\n');
}
ifs.close();

exit(0);
}

Ask Your Own Programming Question
Customer reply replied 8 years ago
I couldn't get it to run
1>c:\users\ty\documents\visual studio 2008\projects\lab 7\lab 7\lab7.cpp(8) : warning C4018: '<' : signed/unsigned mismatch
1>c:\users\ty\documents\visual studio 2008\projects\lab 7\lab 7\lab7.cpp(9) : error C2676: binary '^' : 'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
1>Build log was saved at "file://c:\Users\Ty\Documents\Visual Studio 2008\Projects\Lab 7\Lab 7\Debug\BuildLog.htm"
1>Lab 7 - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Pradeep
Pradeep, Computer Software Engineer
Category: Programming
Satisfied Customers: 80
Experience: BE-Information Technology 2 years of Exp in C, C++ application programming.
Verified
HiCustomer

If you don't mind, can I also work on lab7 ?

Regards
Pradeep
Ask Your Own Programming Question
Ah, I should have asked which compiler you were using. I'll see if I can make some quick adjustments necessary to compile and run in VS2008 and will give a status update within 30 min
Ask Your Own Programming Question
I've made some adjustments so that VS2008 will compile and run correctly, and without any warnings.

main.cpp has been uploaded here: http://wikisend.com/download/569628/main.cpp

I simply added this file to a new "General-->Empty" project in VS2008.

One additional note: If you know that the instructor is using a GNU C++ compiler (most common on Linux or MacOS, which is BSD UNIX) instead of Visual Studio, you will want to change "strcat_s" and "strcpy_s" to "strcat" and "strcpy", respectively. This will cause warnings in visual studio, but it will still compile and run.

Best Regards,
Seth

Take care,
Seth

Edited by Seth on 6/25/2010 at 1:41 PM EST
Seth
Seth, Software Engineer
Category: Programming
Satisfied Customers: 1
Experience: 5 years of field experience using multiple languages and technologies
Verified
Seth and 87 other Programming Specialists are ready to help you
Ask your own question now
HiCustomer

I am done with lab7 as well. Kindly let me know if you have any questions.

Lab7 Download Link.

Sorry Seth, I was already invloved with this customer from his previous posts, so I did this as well.

Regards
Pradep
Ask Your Own Programming Question
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask Seth Your Own Question
Seth
Seth
Seth, Software Engineer
Category: Programming
Satisfied Customers: 1
1 Satisfied Customers
Experience: 5 years of field experience using multiple languages and technologies

Seth is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,175 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
Is there someone that can help me with editing a vbscript file
Is there someone that can help me with editing a vbscript file (using Notepad as a text file)?… read more
Usman
Usman
Associate Degree
31 satisfied customers
I am in need of help with a final Ilab for devry of getting
I am in need of help with a final Ilab for devry of getting all my components working for class 407A and was wondering how much it would be to help me I have some stuff working but stuck on some thing… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
My teacher give me lab but I didn't understand and I make it
my teacher give me lab but I didn't understand and I make it lab but how can I add the while loop … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Assignment 3 Please start with this source code. Write a
Assignment 3 Please start with this source code.Write a program that opens the following text file and processes it contents. The program should display the following per store: The total sales for ea… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Would it be possible to purchase an exsisting answer from this
Would it be possible to purchase an exsisting answer from this link: http://www.justanswer.com/computer-programming/6ctce-cost-homework-help-account.html… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Can I pass you several different projects and have you give
Can I pass you several different projects and have you give me a quote for all of them at one time or would you prefer to do each project individually?… read more
ATLPROG
ATLPROG
Computer Software Engineer
Master's Degree
7,677 satisfied customers
I need help with my project in visual basic 2010. 1) Exercise
I need help with my project in visual basic 2010. 1) Exercise 9, steps b and c, on page 298-299 of the lab textbook, “Clearly Visual Basic”, at the end of Chapter 16… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
For ATLProg Only You Probably have some of these around
For ATLProg Only You Probably have some of these around , But I need two C++ Verions of these, I already have the raptor code completed, but seems my c++ code sucks: It Wont let me paste the entire th… read more
ATLPROG
ATLPROG
Computer Software Engineer
Master's Degree
7,677 satisfied customers
In this lab you will create a console C++ program that will
In this lab you will create a console C++ program that will have the user to enter Celsius temperature readings for each day of the week and then display a report showing both the Celsius and Fahrenhe… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
For Chutz747 Only : I can access the new course Intermediate
For Chutz747 Only : I can access the new course Intermediate Routing and switching. Can you see if you can access this URL (it is a download for the CCNA Virtual Lab software). http://media.wiley.com/… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
848 satisfied customers
I need to write a C++ program to find the smallest number,
I need to write a C++ program to find the smallest number, the largest number, and the average of any five numbers entered by the user. For example, if the five numbers entered are 1, 2, 3, 4, and 5, … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
I need a code in C++ using Microsoft Visual 2008. Below are
I need a code in C++ using Microsoft Visual 2008. Below are the requirements: Objectives • Use an organized, modular approach to develop programs, including appropriate functions and structure (sequen… read more
lifesaver
lifesaver
Computer Software Engineer
Bachelor's Degree
950 satisfied customers
Having some problems with a problem #28 . Can you help I only
Having some problems with a problem #28 . Can you help? I only desire your help time frame is 3 days out.… read more
lifesaver
lifesaver
Computer Software Engineer
Bachelor's Degree
950 satisfied customers
Hello Rick how are you Have you gotten married... didnt
Hello Rick how are you?? Have you gotten married... didn't get me invite.... sad faces.... I am still trugging along with my studies only 7 classes to go!! I am in a Database Class and need some direc… read more
ehabtutor
ehabtutor
Computer Software Engineer
Bachelor's Degree
936 satisfied customers
Hello, I would like someone to build me a spreadsheet like
Hello, I would like someone to build me a spreadsheet like the one listed at http://www.box.net/shared/h3kzzvt7rh or you can use that one to modify if you're comfortable with it. I will use this tool … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Hello Mr. LogicPro, I turned my assignment in early and
Hello Mr. LogicPro, I turned my assignment in early and was informed it is incorrect. It needs to be submitted as a single .cpp file. I attached the instructions. Could you help me with it? http://wik… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Hello Kevin, Hope your 4th was good and safe. I am back in
Hello Kevin, Hope your 4th was good and safe. I am back in class in C++ 2 and need your help again. I need change request 12,13,14 and15 done plus a little program in week one. I am sending you my syl… read more
Kevin Bui
Kevin Bui
Software Developer
Bachelor\u0027s Degree
108 satisfied customers
I need to write a program that compute a cost of taking course,
I need to write a program that compute a cost of taking course, i have to include a costructor with a Course ID, and add a subclass to compute a lab fee for a course that uses a lab, then I need to wr… read more
Raj
Raj
SAP ABAP Consultant
Master\u0027s Degree
27 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x