I am writing a program for class and I keep getting error messages that I am not declaring variables that are clearly declared. I only get this message when I write a program that requires a input from the user. Below is my code that I wrote and the error message can someone tell me what am I doing wrong? I am using Visual Basic and C++.
Thanks in advance.....
1>------ Rebuild All started: Project: Q10p175, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Q10p175', configuration 'Debug|Win32'
1>Compiling...
1>Q10p175.cpp
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 8) : warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 14) : warning C4700: uninitialized local variable 'num_items' used
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 14) : warning C4700: uninitialized local variable 'cost' used
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 15) : warning C4700: uninitialized local variable 'discountRate' used
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>LINK : C:\Documents and Settings\dj0000 34880\Desktop\C omputer Science\Lab Assignment 2\Q10p175\Debug \Q10p175.exe not found or not built by the last incremental link; performing full link
1>Embedding manifest...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\dj0000 34880\Desktop\C omputer Science\Lab Assignment 2\Q10p175\Q10p1 75\Debug\BuildL og.htm"
1>Q10p175 - 0 error(s), 4 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Thanks in advance.....
Code:
#include <iostream>
using namespace std;
int main ()
{
const float TAXRATE = 0.06;
float totalCost, total_discount, taxDue, amountDue;
float cost;
float num_items;
float discountRate;
totalCost = num_items * cost;
total_discount = totalCost - discountRate * totalCost;
taxDue = total_discount * TAXRATE;
amountDue = total_discount + taxDue;
cout<<"Please enter the Cost of all Items: \n";
cin >> cost;
cout<<"Please enter the Numbr of Items: \n";
cin >> num_items;
cout<<"Please enter the Discounted Rate: \n";
cin >> discountRate;
cout<<"The Total Cost is: "<<totalCost<<" .\n";
cout<<"The Tax Due: "<<taxDue<<" .\n";
cout<<"The Amount Due: "<<amountDue<<" \n";
return 0;
}
1>Deleting intermediate and output files for project 'Q10p175', configuration 'Debug|Win32'
1>Compiling...
1>Q10p175.cpp
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 8) : warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 14) : warning C4700: uninitialized local variable 'num_items' used
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 14) : warning C4700: uninitialized local variable 'cost' used
1>c:\documents and settings\dj0000 34880\desktop\c omputer science\lab assignment 2\q10p175\q10p1 75\q10p175.cpp( 15) : warning C4700: uninitialized local variable 'discountRate' used
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>LINK : C:\Documents and Settings\dj0000 34880\Desktop\C omputer Science\Lab Assignment 2\Q10p175\Debug \Q10p175.exe not found or not built by the last incremental link; performing full link
1>Embedding manifest...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\dj0000 34880\Desktop\C omputer Science\Lab Assignment 2\Q10p175\Q10p1 75\Debug\BuildL og.htm"
1>Q10p175 - 0 error(s), 4 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Comment