473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

C++ Algorithm Help

Hi guys,

I'm and Engineer major which means I have to take this C++ class.

Long story short, I need help on our first assignment. I have to admit Im a complete N00B and I'm completely freaked out by this class.

Long story short, I have to modify this formula:

#include <iostream>
using namespace std;

int main()
{
double space, f0, f1;

f0 = 2e-10;
f1 = 2.0000004e-10;

speed = 6.685e8 * (f1 - f0) / (f1 + f0);
cout << "The speed is " << speed << " miles/hour " <<end1;

return 0;
}


To show the frequency a radar gun would recieve for a car going 55 mph.

I tried inputting this:

#include <iostream>
using namespace std;



int main()
{
double speed, f0, speed;

f0 = 2e-10;
speed = 55;

f1 = (-6.685e8 *f0 - speed * f0) / (speed - 6.685e8);
cout << "The frequency is " << f1 << " hertz " <<endl;

return 0;
}

But it keeps saying "Did you forget to include "stdafx.h" to the source file? I tried putting it in the source file but it doesn't work!
Sep 4 '08 #1
3 1613
Laharl
849 Expert 512MB
This implies that you're using Visual Studio. Go to Project->Properties and look for Precompiled Headers. Set it to not use precompiled headers. I'm not completely certain this will fix your problem, but I think it will.
Sep 4 '08 #2
Oh my god. Thanks! It worked!

I really appreciate it!
Sep 4 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
What you did was create a Win32 Console Application project. Microsoft can't resist helping out by adding Microsoft-specific goodies- like stdafx.h and properties like precompiled headers.

You can avoid this stdafx.h problem in the future by properly creating your projects.

You should:
1) Create a Win32 project (not a Win32 Console Application)
2) When the wizard appears do not click Finish.
3) Instead, click Application Settings
4) Select a) console application and b) empty project
5) Now click finish.
Sep 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jack Smith | last post by:
Hello, any help appreciated with following problem. I figured out the algorithm (I think), just having trouble proving it is optimal. Suppose we are given n tasks each of which takes 1 unit...
16
by: cody | last post by:
I have to write an algorithm with must ensure that objects are put in buckets (which are always 4 in size). The objects have two properties: A and B. It is not allowed that in a bucket are objects...
17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
2
by: ben | last post by:
hello, i'm following an algorithm book and am stuck on an early excersise in it, not because of the c programming side of it or even the algorithm side of it, i don't think, but because of maths....
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
6
by: Bernie Yaeger | last post by:
I need a little help with an algorithm. Let's say I have an array with 15 items. I want to find "Fern" where there are "Able", "Me Also", "Zimmerman", etc in no particular order. Forget about...
10
by: Nemok | last post by:
Hi, I am trying to write an additive encryption algorithm in C++ that will encrypt a text by adding a random numer to each character in a string. The code looks similar to this: for(int...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
6
by: StephQ | last post by:
I need to implement an algorithm that takes as input a container and write some output in another container. The containers involved are usually vectors, but I would like not to rule out the...
1
by: almurph | last post by:
Hi everyone, Concerning the Needleman-Wunsch algorithm (cf. http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm) I have noticed a possible loop. Inside the algorithm there is an...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.