Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4605846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:29:11+00:00 2026-05-22T00:29:11+00:00

If you take a look at the code below you can see that I

  • 0

If you take a look at the code below you can see that I am running an if statement to check whether or not a text field is empty, if it is empty it runs the while loop. My question is when I am comparing the the two Variables, Q and Qc I only want to test the loop to a certain decimal place for example the tenths place.

I tried using @”%.1f” along with the variable but I am guessing my syntax is wrong. If someone could help me I would appreciate it.

        if ([heightTextField.text isEqualToString:@""]) {
            while (Q != Qc) {
                Hc = Hc + 0.01;
                Qc = 1.486*(Hc*W)*(powf(((Hc*W)/(2*Hc+2*W)), 0.6666666667))*(powf(S, 0.50))/n;
                H = Hc;
            }
        }
        if ([widthTextField.text isEqualToString:@""]) {
            while (Q != Qc) {
                Wc = Wc + 0.01;
                Qc = 1.486*(H*Wc)*(powf(((H*Wc)/(2*H+2*Wc)), 0.6666666667))*(powf(S, 0.50))/n;
                W = Wc;
            }
        }

Thanks,
Dana

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:29:11+00:00Added an answer on May 22, 2026 at 12:29 am

    There may be an easier way to go about this, but off hand, this would be the approach I would take.

    First off, and this may not apply to you, but I’ve had issues comparing a textField to @”” (where it would never say this is true), so I had since used if ([myTextField.text length]) instead.

    As for the comparison, this is the code I would use:

    NSString *qString = [NSString stringWithFormat:@"%.1f", Q];
    NSString *qcString = [NSString stringWithFormat:@"%.1f", Qc];
    while (![qString isEqualToString:qcString]) {
        // continue code to update Qc...;
        // update qcString;
        qcString = [NSString stringWithFormat:@"%.1f", Qc];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at the ssl_requirement plugin. Shouldn't it check to see if you're
Hey everyone, take a look at the code below and appreciate how messy the
take a look at this example code: public class Comment { private Comment() {
Please take a look at the html listed below and let me know why
Where would i go to look for algorithms that take a 2d grid of
OK, first for context look at the Windows desktop; You can take items (folders,
Take a look at my code here: public static ItemType GetItem(int id) { ItemType
I was wondering if anyone could take a look at this code and help
Take a look at the graphics part of the GoogleAPI reference . It says
If you take a look at the clock_gettime() function, which is available in all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.